RamKumar
RamKumar

Reputation: 126

pip3 install mysql-python failed with error code 1 in /tmp/pip-install-4nev4id4/mysql-python/

I am new in python on flask, when i try to install mysql-python by entering the
following command in terminal

pip3 install mysql-python

it shows the following error:

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-install-4nev4id4/mysql-python/setup.py", line 13, in <module>
        from setup_posix import get_config
      File "/tmp/pip-install-4nev4id4/mysql-python/setup_posix.py", line 2, in <module>
        from ConfigParser import SafeConfigParser
    ModuleNotFoundError: No module named 'ConfigParser'

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-install-4nev4id4/mysql-python/

and then I use this command sudo apt install default-libmysqlclient-dev in terminal which has been suggested by many i checked on stackoverflow.

and then I retry to install mysql-python but also it is showing the same error, can anyone please help me.

Upvotes: 1

Views: 6143

Answers (2)

Eugene Yarmash
Eugene Yarmash

Reputation: 149756

mysql-python only supports Python 2.x, while you seem to be using Python 3. From the linked PyPI page:

MySQL-3.23 through 5.5 and Python-2.4 through 2.7 are currently supported. Python-3.0 will be supported in a future release.

To connect to MySQL from Python 3 you can use other alternatives:

Upvotes: 1

buran
buran

Reputation: 14233

MySQL-python does not support python3. That is why you get this particular error

ModuleNotFoundError: No module named 'ConfigParser'

In python3 ConfigParser is renamed configparser

One option to connect to MySQL DB is official python connector

Another option is pyodbc

Other options are provided in other answers

Upvotes: 0

Related Questions