苹果操作系统 | Python 2.7
我想使用 MySQLdb。当我运行时
pip install MySQL-python
结果是
JourneydeMacBook-Pro:~ JourneyWoo$ 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/g9/y4rms8zx6yvjjn1m1w6w0000gn/T/pip-build-JFpAwP/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/g9/y4rms8zx6yvjjn1m1w6w0000gn/T/pip-build-JFpAwP/MySQL-python/
我认为我的 pip 有问题,所以我运行
pip install --upgrade setuptools
pip install ez_setup
pip install unroll
它们都运行良好,但是当我再次尝试时
pip install MySQL-python
还是有问题
我没有从 Google 搜索中得到可以解决我的问题的答案,如果你能帮助我,真的谢谢你。
最佳答案
sudo apt-get install python-dev default-libmysqlclient-dev # Debian/Ubuntu 运行这个解决了我的问题
关于python - pip install MySQL-python,命令 "python setup.py egg_info"失败,错误代码为 1,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44343133/