本文介绍了Ubuntu 17:无法安装mysqlclient的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

尝试遵循Django教程,但我无法安装mysqlclient.

Trying to follow a Django tutorial but I cannot install mysqlclient.

本教程声称我可以使用以下命令来做到这一点:

The tutorial claims that I can do so with the following command:

pip install mysqlclient

但这会产生此错误:

Collecting mysqlclient   Using cached mysqlclient-1.3.12.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-rrolctwh/mysqlclient/setup.py", line 17, in <module>
        metadata, options = get_config()
      File "/tmp/pip-build-rrolctwh/mysqlclient/setup_posix.py", line 44, in get_config
        libs = mysql_config("libs_r")
      File "/tmp/pip-build-rrolctwh/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-rrolctwh/mysqlclient/

我安装了最新的pip和virtualenv.

I have the most up-to-date pip and virtualenv installed.

我希望能够安装mysqlclient,以便我可以继续学习本教程.

I would like to be able to install mysqlclient so that I may continue with the tutorial.

推荐答案

您还应该安装mysql和python开发标头和库: https://github.com/PyMySQL/mysqlclient-python#prerequisites

You should also install the mysql and python development headers and libraries:https://github.com/PyMySQL/mysqlclient-python#prerequisites

这篇关于Ubuntu 17:无法安装mysqlclient的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

06-09 10:57