我想为我的代码尝试sqlalchemy,但为了使用它,我需要首先安装mysql-python。我下载了软件包,但当我尝试{python setup.py install}时,它给了我一个我无法理解的错误。无法安装MySQL-Python
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-dev不可用,但被其他软件包引用。 这可能意味着包丢失,已过时,或 只能从其他来源 但是下面的软件包替换: 蟒蛇 E:包“的python-dev的”没有安装candidate' – tlbakh
嗯,这有点奇怪...你可以尝试在Synaptic中查找'python-dev',并从那里安装它? –
如果我没有做错什么,突触说python2.7-dev坏了。这很奇怪。 – tlbakh