无法安装MySQL-Python [英] can't install MySQL-Python

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

问题描述

我想为自己的代码尝试sqlalchemy,但是要使用它,我需要首先安装mysql-python.我下载了软件包,但是当我尝试{python setup.py install}时,它给了我一个我听不懂的错误.

I wanted to try sqlalchemy for my code but in order to use it I need first to install mysql-python. I downloaded the package but when I tried {python setup.py install} it gives me an error that I cannot understand.

running build
running build_py
copying MySQLdb/release.py -> build/lib.linux-i686-2.7/MySQLdb
running build_ext
building '_mysql' extension
i686-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -Dversion_info=(1,2,4,'beta',4) -D__version__=1.2.4b4 -I/usr/include/mysql -I/usr/include/python2.7 -c _mysql.c -o build/temp.linux-i686-2.7/_mysql.o -DBIG_JOINS=1 -fno-strict-aliasing -g -DNDEBUG
_mysql.c:29:20: fatal error: Python.h: No such file or directory
 compilation terminated. error: command 'i686-linux-gnu-gcc' failed with exit status 1

sudo apt-get install python2.7-dev

Reading package lists... Done
Building dependency tree       
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
python2.7-dev : Depends: libpython2.7-dev (= 2.7.4-2ubuntu3.2) but it is not     going to be installed
             Depends: libexpat1-dev but it is not installable
E: Unable to correct problems, you have held broken packages.

推荐答案

如果用于python 3.6,则必须安装相应的python3-dev,即:

If it is for python 3.6, you have to install corresponding python3-dev, i.e:

sudo apt-get install python3.6-dev

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

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆