Benature/WordReview

安装mysqlclient中,mysql_config:not found

ReyRen opened this issue · 2 comments

描述问题
根据install指南开发者安装方式中,当执行pip install -r requirements.txt, 报错

复现问题
复现问题的步骤:

  1. 安装了miniconda
  2. 退出base环境
  3. 创建了tbword虚拟环境
  4. 按照install步骤执行
Collecting mysqlclient==1.4.6
  Downloading http://mirrors.cloud.aliyuncs.com/pypi/packages/d0/97/7326248ac8d5049968bf4ec708a5d3d4806e412a42e74160d7f266a3e03a/mysqlclient-1.4.6.tar.gz (85 kB)
     |████████████████████████████████| 85 kB 16.6 MB/s 
    ERROR: Command errored out with exit status 1:
     command: /root/miniconda3/envs/tgword/bin/python -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-dlbswyhc/mysqlclient_b39c6ca8108e4362be73b695bcdedf35/setup.py'"'"'; __file__='"'"'/tmp/pip-install-dlbswyhc/mysqlclient_b39c6ca8108e4362be73b695bcdedf35/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-pip-egg-info-07v0z705
         cwd: /tmp/pip-install-dlbswyhc/mysqlclient_b39c6ca8108e4362be73b695bcdedf35/
    Complete output (12 lines):
    /bin/sh: 1: mysql_config: not found
    /bin/sh: 1: mariadb_config: not found
    /bin/sh: 1: mysql_config: not found
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-install-dlbswyhc/mysqlclient_b39c6ca8108e4362be73b695bcdedf35/setup.py", line 16, in <module>
        metadata, options = get_config()
      File "/tmp/pip-install-dlbswyhc/mysqlclient_b39c6ca8108e4362be73b695bcdedf35/setup_posix.py", line 61, in get_config
        libs = mysql_config("libs")
      File "/tmp/pip-install-dlbswyhc/mysqlclient_b39c6ca8108e4362be73b695bcdedf35/setup_posix.py", line 29, in mysql_config
        raise EnvironmentError("%s not found" % (_mysql_config_path,))
    OSError: mysql_config not found
    ----------------------------------------
WARNING: Discarding http://mirrors.cloud.aliyuncs.com/pypi/packages/d0/97/7326248ac8d5049968bf4ec708a5d3d4806e412a42e74160d7f266a3e03a/mysqlclient-1.4.6.tar.gz#sha256=f3fdaa9a38752a3b214a6fe79d7cae3653731a53e577821f9187e67cbecb2e16 (from http://mirrors.cloud.aliyuncs.com/pypi/simple/mysqlclient/). Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
ERROR: Could not find a version that satisfies the requirement mysqlclient==1.4.6 (from versions: 1.3.0, 1.3.1, 1.3.2, 1.3.3, 1.3.4, 1.3.5, 1.3.6, 1.3.7, 1.3.8, 1.3.9, 1.3.10, 1.3.11rc1, 1.3.11, 1.3.12, 1.3.13, 1.3.14, 1.4.0rc1, 1.4.0rc2, 1.4.0rc3, 1.4.0, 1.4.1, 1.4.2, 1.4.2.post1, 1.4.3, 1.4.4, 1.4.5, 1.4.6, 2.0.0, 2.0.1, 2.0.2, 2.0.3)
ERROR: No matching distribution found for mysqlclient==1.4.6

这是我之前做的笔记,不确定对这个报错有没有帮助,可以先试试看?


sudo pip3 install mysqlclient

if you find some mistakes when installing mysqlclient, there are some suggestion below to help you solve the problems
but if all the advice are not effective, please search on the internet for help

install setupTool

pip3 install --upgrade setupTools
wget https://pypi.python.org/packages/source/s/setuptools/setuptools-0.6c11.tar.gz
tar zxvf setuptools-0.6c11.tar.gz
cd setuptools-0.6c11

install libmysqlclient-dev

sudo apt install libmysqlclient-dev

or

sudo apt-get install python3 python-dev python3-dev \
     build-essential libssl-dev libffi-dev \
     libxml2-dev libxslt1-dev zlib1g-dev \
     python-pip

有效~~,感谢
/closed