Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-tu6ygqzj/mysql-python/

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.

like image 342
guneet kakkar Avatar asked Dec 11 '22 03:12

guneet kakkar


2 Answers

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
like image 156
Jeril Avatar answered Dec 21 '22 17:12

Jeril


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

like image 38
Lewis Avatar answered Dec 21 '22 18:12

Lewis