2
votes

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

1 Answers

1
votes

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