pip command issue - Command “python setup.py egg_info” failed with error code 1 in /private/tmp/pip-build-7n_jim1n/mysql-python/

只谈情不闲聊 提交于 2019-12-12 19:36:27

问题


I am using MACos Terminal, and unable to install mysql on python.

pip3 install mysql-python

The directory '/Users/aligrdas/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/aligrdas/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 159kB/s Complete output from command python setup.py egg_info: Traceback (most recent call last): File "", line 1, in File "/private/tmp/pip-build-7n_jim1n/mysql-python/setup.py", line 13, in from setup_posix import get_config File "/private/tmp/pip-build-7n_jim1n/mysql-python/setup_posix.py", line 2, in from ConfigParser import SafeConfigParser ModuleNotFoundError: No module named 'ConfigParser'

----------------------------------------

Command "python setup.py egg_info" failed with error code 1 in /private/tmp/pip-build-7n_jim1n/mysql-python/


回答1:


As per PEP 8 standard ConfigParser has been renamed to lower case as configparser in Python 3 and package you are trying to install is not updated yet or may be does not support it.

try using following command:

pip install mysqlclient

check if mysql-connector-c is installed on your system if not use following command:

brew install mysql-connector-c

working solution for question:

1) brew unlink mysql-connector-c 
2) brew install mysql 
3) brew link mysql-connector-c 
4) sudo pip install mysqlclient


来源:https://stackoverflow.com/questions/50510320/pip-command-issue-command-python-setup-py-egg-info-failed-with-error-code-1

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!