I am using python3 to install mysql-python package. So, when I run
pip install mysql-python,
it gives me error.
Tried using
pip install --upgrade setuptools
It shows
Collecting mysql-python
Using cached https://files.pythonhosted.org/packages/a5/e9/51b544da85a36a68debe7a7091f068d802fc515a3a202652828c73453cad/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 "/tmp/pip-build-tu6ygqzj/mysql-python/setup.py", line 13, in <module>
from setup_posix import get_config
File "/tmp/pip-build-tu6ygqzj/mysql-python/setup_posix.py", line 2, in <module>
from ConfigParser import SafeConfigParser
**ImportError: No module named 'ConfigParser'**
----------------------------------------
***Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-tu6ygqzj/mysql-python/***
Successfully installed with all files in it.
I guess you need to install the following:
pip install mysqlclient
In Python 3, ConfigParser
has been renamed to configparser
for PEP 8 compliance.
mysqlclient
is a fork ofmysql-python
, with Python 3 support.
Kindly make sure you have installed the following before installing mysqlclient
:
sudo apt-get install python3-dev libmysqlclient-dev
For Lunix and Mac Machines, install the mysqlclient pre-requisites via:
Debian / Ubuntu - sudo apt-get install python-dev default-libmysqlclient-dev
Red Hat / CentOS - sudo yum install python-devel mysql-devel
macOS (Homebrew) - brew install mysql-client
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With