错误:安装mysqlclient时命令"x86_64-linux-gnu-gcc" [英] error: command 'x86_64-linux-gnu-gcc' when installing mysqlclient
问题描述
我在virtualenv中安装了django 1.8.5并使用python 3.4.3 使用sqlite时,作品会显示它的作品页面
I installed django 1.8.5 in virtualenv and using python 3.4.3 the worked displayed the it works page when using sqlite
我想使用mysql,并且正在尝试使用
I wanted to use mysql and I'm trying to install mysqlclient using
pip install mysqlclient
我收到以下消息
----------------------------------------
Failed building wheel for mysqlclient
Failed to build mysqlclient
Installing collected packages: mysqlclient
Running setup.py install for mysqlclient
Complete output from command /home/sasidhar/django/env/bin/python3 -c "import setuptools, tokenize;__file__='/tmp/pip-build-5lj39q67/mysqlclient/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-da2_35zs-record/install-record.txt --single-version-externally-managed --compile --install-headers /home/sasidhar/django/env/include/site/python3.4/mysqlclient:
running install
running build
running build_py
copying MySQLdb/release.py -> build/lib.linux-x86_64-3.4/MySQLdb
running build_ext
building '_mysql' extension
x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 -fPIC -Dversion_info=(1,3,6,'final',1) -D__version__=1.3.6 -I/usr/include/mysql -I/usr/include/python3.4m -I/home/sasidhar/django/env/include/python3.4m -c _mysql.c -o build/temp.linux-x86_64-3.4/_mysql.o -DBIG_JOINS=1 -fno-strict-aliasing -g -DNDEBUG
_mysql.c:40:20: fatal error: Python.h: No such file or directory
#include "Python.h"
^
compilation terminated.
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
----------------------------------------
Command "/home/sasidhar/django/env/bin/python3 -c "import setuptools, tokenize;__file__='/tmp/pip-build-5lj39q67/mysqlclient/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-da2_35zs-record/install-record.txt --single-version-externally-managed --compile --install-headers /home/sasidhar/django/env/include/site/python3.4/mysqlclient" failed with error code 1 in /tmp/pip-build-5lj39q67/mysqlclient
我确实尝试安装,问题仍然存在
请帮助我解决这个问题
谢谢你们!!
and still the problem persists
please help me solve this problem
Thanks guys!!
推荐答案
您需要安装python-dev:
You need to install python-dev:
sudo apt-get install python-dev
而且,由于您使用的是python3:
And, since you are using python3:
sudo apt-get install python3-dev
此命令应为您提供帮助.
This command should help you.
如果您使用的是Mac OS,则可以尝试:
If you are using mac os you might try:
brew update && brew rm python3 && brew install python3
您需要酝酿已安装,否则可以安装它.这对于在Mac OS中获取软件包非常有用. http://brew.sh/
You need to brew has been installed already, otherwise you can install it. It is very useful for getting packages in Mac OS. http://brew.sh/
这篇关于错误:安装mysqlclient时命令"x86_64-linux-gnu-gcc"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!