我正在使用OSX El Capitan,使用Python 2.7(Anaconda)。运行命令pip install MySQL-python
会出现以下情况:
Collecting MySQL-python
Using cached MySQL-python-1.2.5.zip
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/private/var/folders/d2/gd004m2s35z5dlyz9mfn6sc40000gn/T/pip-build-FYvb_T/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
这些都没有起作用(退出时出现相同的错误)。
pip install mysqlclient
easy_install MySQL-python
pip
已经是最新版本。我已经尝试了所有相关问题中的建议,但都没有成功。非常感谢您的帮助!
mysql-python
之前,您可能还需要运行以下命令:export LDFLAGS="-L/usr/local/opt/openssl/lib"
和export CPPFLAGS="-I/usr/local/opt/openssl/include"
。请参阅brew info openssl
的输出。 - Railslide