4

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.

2

3 Answers 3

12

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 of mysql-python, with Python 3 support.

Kindly make sure you have installed the following before installing mysqlclient:

sudo apt-get install python3-dev libmysqlclient-dev
Sign up to request clarification or add additional context in comments.

1 Comment

what has to be done for amazon linux 2 since it is giving me error '1 packages excluded due to repository priority protections'
1

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

Comments

0

I tried to do this before that so after this it command work:

apt-get install libmysqlclient-dev

Comments

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.