我无法在python中安装mysqlclient和枕头

时间:2017-12-22 19:03:27

标签: python django linux

我想安装mysqlclient但它返回我

(venv)amir@amg76:~/Documents/Computer/Python/Django/vira/virasciencecom$ pip3 install mysqlclient==1.3.7
Collecting mysqlclient==1.3.7
  Using cached mysqlclient-1.3.7.tar.gz
    Complete output from command python setup.py egg_info:
    /bin/sh: 1: mysql_config: not found
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-build-c5i8m5ok/mysqlclient/setup.py", line 17, in <module>
        metadata, options = get_config()
      File "/tmp/pip-build-c5i8m5ok/mysqlclient/setup_posix.py", line 44, in get_config
        libs = mysql_config("libs_r")
      File "/tmp/pip-build-c5i8m5ok/mysqlclient/setup_posix.py", line 26, in mysql_config
        raise EnvironmentError("%s not found" % (mysql_config.path,))
    OSError: mysql_config not found

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-c5i8m5ok/mysqlclient/
当我尝试安装枕头并使用python 3.6和ubuntu 17.10时,同样的事情发生了 任何人都可以帮助我吗?

1 个答案:

答案 0 :(得分:1)

您需要从发行版软件包存储库中安装libmysqlclient-devlibmariaclient-dev,具体取决于您是否分别使用mysql或mariadb。