centos 7 pip install MySQL-python error

pip install MySQL-python error

 

pip install MySQL-python
DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7.
Looking in indexes: http://mirrors.cloud.aliyuncs.com/pypi/simple/
Collecting MySQL-python
  Downloading http://mirrors.cloud.aliyuncs.com/pypi/packages/a5/e9/51b544da85a36a68debe7a7091f068d802fc515a3a202652828c73453cad/MySQL-python-1.2.5.zip (108kB)
     |████████████████████████████████| 112kB 56.4MB/s
    ERROR: Complete output from command python setup.py egg_info:
    ERROR: sh: mysql_config: command not found
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-install-kfRwp2/MySQL-python/setup.py", line 17, in <module>
        metadata, options = get_config()
      File "setup_posix.py", line 43, in get_config
        libs = mysql_config("libs_r")
      File "setup_posix.py", line 25, in mysql_config
        raise EnvironmentError("%s not found" % (mysql_config.path,))
    EnvironmentError: mysql_config not found
    ----------------------------------------
ERROR: Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-install-kfRwp2/MySQL-python/
WARNING: You are using pip version 19.1.1, however version 19.3.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.

Online see the need to install python-devel mysql-devel, etc.

Try yum install python-devel mysql-devel, mysql-devel have dependency problems, the following error

---> Package libss.x86_64 0:1.42.9-16.el7 will be an update
Removing mariadb-libs.x86_64 1:5.5.64-1.el7 - u due to obsoletes from installed mysql-community-libs-5.6.45-2.el7.x86_64
base/7/x86_64/filelists_db                                                                                                  | 7.3 MB  00:00:00
--> Restarting Dependency Resolution with new changes.
--> Running transaction check
---> Package mariadb-libs.x86_64 1:5.5.64-1.el7 will be installed
--> Processing Dependency: mariadb-libs(x86-64) = 1:5.5.64-1.el7 for package: 1:mariadb-devel-5.5.64-1.el7.x86_64
--> Finished Dependency Resolution
Error: Package: 1:mariadb-devel-5.5.64-1.el7.x86_64 (base)
           Requires: mariadb-libs(x86-64) = 1:5.5.64-1.el7
 You could try using --skip-broken to work around the problem
 You could try running: rpm -Va --nofiles --nodigest

Online advice is to go directly to mysql official website to download the corresponding version of MySQL-devel

Upload rpm package MySQL-devel-5.6.46-1.el7.x86_64.rpm to the server, after the command to install mysql-devel

yum install MySQL-devel-5.6.46-1.el7.x86_64.rpm -y

After running pip install MySQL-python error there, saw the error, it seems that we will need a MySQL-python

yum install MySQL-python -y

After running a successful pip install MySQL-python

 

to sum up:

The next time the installation to run as follows, try, there is an error, and then view

yum install python-devel mysql-devel zlib zlib-devel openssl-devel MySQL-python -y 

pip install MySQL-python

Guess you like

Origin www.cnblogs.com/faberbeta/p/python003.html