django 错误之 OSError: mysql_config not found

Posted 不懂得小白

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了django 错误之 OSError: mysql_config not found相关的知识,希望对你有一定的参考价值。

pip 导入包时出现如下错误

 1  Complete output from command python setup.py egg_info:
 2     /bin/sh: 1: mysql_config: not found
 3     Traceback (most recent call last):
 4       File "<string>", line 1, in <module>
 5       File "/tmp/pip-install-6p9kqc0e/mysqlclient/setup.py", line 17, in <module>
 6         metadata, options = get_config()
 7       File "/tmp/pip-install-6p9kqc0e/mysqlclient/setup_posix.py", line 44, in get_config
 8         libs = mysql_config("libs_r")
 9       File "/tmp/pip-install-6p9kqc0e/mysqlclient/setup_posix.py", line 26, in mysql_config
10         raise EnvironmentError("%s not found" % (mysql_config.path,))
11     OSError: mysql_config not found
12     
13     ----------------------------------------
14 Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-install-6p9kqc0e/mysqlclient/

出现上面错误主要还是因为未安装python依赖,及mysqlclient:

问题解决:

1 sudo apt-get install python3-dev libmysqlclient-dev
2 pip install mysqlclient

 

以上是关于django 错误之 OSError: mysql_config not found的主要内容,如果未能解决你的问题,请参考以下文章

Django错误OSError: raw write() returned invalid length 14 (should have been between 0 and 7)

Django OSError:[Errno 13] 权限被拒绝

Python随心记--python之错误:OSError: [WinError 10048]

OSError: [Errno 2] 在 Django 中使用 python 子进程时没有这样的文件或目录

OSError:[Errno 2]在Django中使用python子进程时没有这样的文件或目录

OSError: cannot open resource(pillow错误处理)