【发布时间】:2019-08-18 12:12:10
【问题描述】:
我一直在尝试在 mac 上安装 python-MySQLdb,但一直出错。我已经尝试了很多替代方法来传递该错误。
sudo PATH=/usr/local/Cellar/mysql/bin/:$PATH pip install mysql-python
Password:
DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7.
The directory '/Users/zuhairhallak/Library/Caches/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/Users/zuhairhallak/Library/Caches/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Collecting mysql-python
Downloading https://files.pythonhosted.org/packages/a5/e9/51b544da85a36a68debe7a7091f068d802fc515a3a202652828c73453cad/MySQL-python-1.2.5.zip (108kB)
100% |████████████████████████████████| 112kB 2.6MB/s
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/private/tmp/pip-install-RtF2js/mysql-python/setup.py", line 17, in <module>
metadata, options = get_config()
File "setup_posix.py", line 53, in get_config
libraries = [ dequote(i[2:]) for i in libs if i.startswith(compiler_flag("l")) ]
File "setup_posix.py", line 8, in dequote
if s[0] in "\"'" and s[0] == s[-1]:
IndexError: string index out of range
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /private/tmp/pip-install-RtF2js/mysql-python/
我也运行了 sudo -H pip install mysql-python 并且得到了不同的错误
生成了 13 条警告。 cc -bundle -undefined dynamic_lookup -Wl,-F。 build/temp.macosx-10.14-intel-2.7/_mysql.o -L/usr/local/Cellar/mysql/8.0.15/lib -lmysqlclient -lssl -lcrypto -o build/lib.macosx-10.14-intel-2.7 /_mysql.so ld:找不到 -lssl 的库 clang:错误:链接器命令失败,退出代码为 1(使用 -v 查看调用) 错误:命令“cc”失败,退出状态为 1
mysql-python 构建轮子失败 为 mysql-python 运行 setup.py clean 无法构建 mysql-python 安装收集的包:mysql-python 为 mysql-python 运行 setup.py install ... 错误 命令的完整输出 /usr/bin/python -u -c "import setuptools, tokenize;file='/private/tmp/pip-install-3A8kOd/mysql-python/setup.py'; f=getattr(tokenize, 'open', open)(file);code=f.read().replace('\r\n', '\n');f.close( );exec(compile(code, file, 'exec'))" install --record /private/tmp/pip-record-TUb4up/install-record.txt --single-version-externally -托管--编译
【问题讨论】:
-
它不是重复的问题,但对于我尝试的每个替代解决方案,我总是遇到不同的错误。解决了我的问题