2

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 Answer 1

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
Sign up to request clarification or add additional context in comments.

6 Comments

raise EnvironmentError("%s not found" % (mysql_config.path,)) EnvironmentError: mysql_config not found ---------------------------------------- Command "python setup.py egg_info" failed with error code 1 in /private/tmp/pip-install-R1Dazz/mysqlclient/
sh: mysql_config: command not found EnvironmentError: mysql_config not found ---------------------------------------- Command "python setup.py egg_info" failed with error code 1 in /private/tmp/pip-install-qVwv3A/mysqlclient/
use brew install mysql and export PATH=$PATH:/usr/local/mysql/bin and then above command
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-dvgCAv/mysqlclient/setup.py", line 17, in <module> metadata, options = get_config() File "setup_posix.py", line 54, in get_config libraries = [dequote(i[2:]) for i in libs if i.startswith('-l')] File "setup_posix.py", line 12, in dequote if s[0] in "\"'" and s[0] == s[-1]: IndexError: string index out of range
try with flags on LDFLAGS=-L/usr/local/opt/openssl/lib pip install mysqlclient
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.