运行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/b_/xh05hxwd0lzc3rm858jsypdc0000gn/T/pip-build-AWDYaP/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/var/folders/b_/xh05hxwd0lzc3rm858jsypdc0000gn/T/pip-build-AWDYaP/mysql-python/我按照Python帖子中的说明重新安装了setuptools,并且已经从https://www.python.org/重新安装了this
which -a python给出了
/Library/Frameworks/Python.framework/Versions/2.7/bin/python
/usr/local/bin/python
/usr/bin/python该错误似乎是在安装MacOS 10.12.4更新后发生的
发布于 2017-04-27 06:00:33
用这个解决了
brew install mysql
pip install MySQL-python发布于 2018-02-02 17:56:13
如果您仍然失败,并出现类似于“为mysql-python构建轮子失败”之类的错误,请尝试
LDFLAGS=-L/usr/local/opt/openssl/lib pip install mysql-python这对我来说就像是一种魔力。
发布于 2019-01-30 05:16:36
这对我很有效(macOS Mojave 10.14.2):
brew install mysql@5.7
brew link --force mysql@5.7
brew install mysql-client
LDFLAGS=-L/usr/local/opt/openssl/lib pip install mysql-pythonhttps://stackoverflow.com/questions/43634584
复制相似问题