在 django 虚拟环境中安装 mysql 客户端

Installing mysql client in django virtual environment

我创建了一个虚拟环境,python 3 并安装了 django
我无法安装 mysqlclient,它说 setup.py

有问题
jayanthi@jayanthi-Aspire-4920:~$ source env/bin/activate
(env) jayanthi@jayanthi-Aspire-4920:~$ pip install mysqlclient
Collecting mysqlclient
      Using cached mysqlclient-1.3.10.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-4pbezvx6/mysqlclient/setup.py", line 17, in <module>
            metadata, options = get_config()
          File "/tmp/pip-build-4pbezvx6/mysqlclient/setup_posix.py", line 44, in get_config
            libs = mysql_config("libs_r")
          File "/tmp/pip-build-4pbezvx6/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-4pbezvx6/mysqlclient/

在 Ubuntu 您必须安装软件包:

sudo apt-get install libmysqlclient-dev