无法使用pip安装mysqlclient

时间:2019-11-07 22:50:47

标签: mysql python-2.7 centos7 mysql-connector

我尝试安装mysqlclient,但抱怨mysql_config文件不存在。阅读文档后。我尝试安装sudo yum install mariadb-develsudo yum install mysql-devel。我仍然遇到相同的错误。我正在使用centos 7

sudo pip install mysqlclient
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. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support
WARNING: The directory '/home/bramaraju/.cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
WARNING: The directory '/home/bramaraju/.cache/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Looking in indexes: https://security_automation:****@box.jfrog.io/box/api/pypi/Security-PyPi-Local/simple, https://security_automation:****@box.jfrog.io/box/api/pypi/box-pypi/simple, https://pypi.python.org/simple
Collecting mysqlclient
  Downloading https://box.jfrog.io/box/api/pypi/box-pypi/packages/packages/f8/9b/5db9a03e2088a87c26e3e4d4c7f7e8f4c2dbae610f9521cdfac15755a795/mysqlclient-1.4.5.tar.gz (86kB)
     |████████████████████████████████| 92kB 5.3MB/s 
    ERROR: Command errored out with exit status 1:
     command: /usr/bin/python2 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-KrW_Ny/mysqlclient/setup.py'"'"'; __file__='"'"'/tmp/pip-install-KrW_Ny/mysqlclient/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-install-KrW_Ny/mysqlclient/pip-egg-info
         cwd: /tmp/pip-install-KrW_Ny/mysqlclient/
    Complete output (12 lines):
    sh: mysql_config: command not found
    sh: mariadb_config: command not found
    sh: mysql_config: command not found
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-install-KrW_Ny/mysqlclient/setup.py", line 16, in <module>
        metadata, options = get_config()
      File "setup_posix.py", line 61, in get_config
        libs = mysql_config("libs")
      File "setup_posix.py", line 29, in mysql_config
        raise EnvironmentError("%s not found" % (_mysql_config_path,))
    EnvironmentError: mysql_config not found
    ----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

但是在安装mysql-devel时。我收到以下错误消息。因此使用sudo yum安装了mysql-devel --skip-broken


--> Finished Dependency Resolution
Error: Package: zlib-devel-1.2.7-18.el7.x86_64 (cie-base)
           Requires: zlib = 1.2.7-18.el7
           Installed: lib64zlib1-1.2.8-7.1.mga5.x86_64 (@security-rpm-local-thirdparty)
               zlib = 1.2.8-7.1.mga5
           Available: zlib-1.2.7-18.el7.i686 (cie-base)
               zlib = 1.2.7-18.el7
 You could try using --skip-broken to work around the problem
 You could try running: rpm -Va --nofiles --nodigest

1 个答案:

答案 0 :(得分:0)

您从回购@ security-rpm-local-thirdparty中有zlib,这是有冲突的。拥有这样的软件包将与您希望安装的许多Centos / RHEL软件包冲突。

建议删除lib64zlib1 / 1.2.8-7.1.mga5并安装系统zlib。

相关问题