lib/sqlalchemy/cextension/processors.c:10:20: 致命错误: Python.h:没有那个文件或目录

时间:2021-09-01 12:42:51

 

本文地址http://www.cnblogs.com/yhLinux/p/4063444.html

 

$ sudo easy_install sqlalchemy
[sudo] password for ovonel: 
Searching for sqlalchemy
Reading http://pypi.python.org/simple/sqlalchemy/
Best match: SQLAlchemy 0.9.8
Downloading https://pypi.python.org/packages/source/S/SQLAlchemy/SQLAlchemy-0.9.8.tar.gz#md5=470ca4da4a0081efc830f0d90dd91682
Processing SQLAlchemy-0.9.8.tar.gz
Running SQLAlchemy-0.9.8/setup.py -q bdist_egg --dist-dir /tmp/easy_install-niIczD/SQLAlchemy-0.9.8/egg-dist-tmp-K7Kb1x
warning: no files found matching '*.jpg' under directory 'doc'
warning: no files found matching 'distribute_setup.py'
warning: no files found matching 'sa2to3.py'
warning: no files found matching 'ez_setup.py'
no previously-included directories found matching 'doc/build/output'
lib/sqlalchemy/cextension/processors.c:10:20: 致命错误: Python.h:没有那个文件或目录
编译中断。

 

 出现这个问题的原因是,系统中的python是自带的,而没有安装python的开发包并没有安装,

所以在shell下执行如下命令:

$ sudo apt-get install python-dev

 

 

$ sudo easy_install sqlalchemy
Searching for sqlalchemy
Reading http://pypi.python.org/simple/sqlalchemy/
Best match: SQLAlchemy 0.9.8
Downloading https://pypi.python.org/packages/source/S/SQLAlchemy/SQLAlchemy-0.9.8.tar.gz#md5=470ca4da4a0081efc830f0d90dd91682
Processing SQLAlchemy-0.9.8.tar.gz
Running SQLAlchemy-0.9.8/setup.py -q bdist_egg --dist-dir /tmp/easy_install-Nu0lzS/SQLAlchemy-0.9.8/egg-dist-tmp-R1tVSz
warning: no files found matching '*.jpg' under directory 'doc'
warning: no files found matching 'distribute_setup.py'
warning: no files found matching 'sa2to3.py'
warning: no files found matching 'ez_setup.py'
no previously-included directories found matching 'doc/build/output'
zip_safe flag not set; analyzing archive contents...
sqlalchemy.testing.plugin.noseplugin: module references __file__
Adding SQLAlchemy 0.9.8 to easy-install.pth file

Installed /usr/local/lib/python2.7/dist-packages/SQLAlchemy-0.9.8-py2.7-linux-x86_64.egg
Processing dependencies for sqlalchemy
Finished processing dependencies for sqlalchemy

 

 缷载easy_install安装的包

(个人感觉easy_install没有pip方便,推荐大家使用pip安装和缷载https://pypi.python.org/pypi/pip

 

如何缷载esay_install安装的sqlalchemy呢,这里是官方文档:

https://pythonhosted.org/setuptools/easy_install.html#uninstalling-packages

 

$ sudo easy_install -m sqlalchemy
Searching for sqlalchemy
Best match: SQLAlchemy 0.9.8
Processing SQLAlchemy-0.9.8-py2.7.egg

Using /usr/local/lib/python2.7/dist-packages/SQLAlchemy-0.9.8-py2.7.egg

Because this distribution was installed --multi-version, before you can
import modules from this package in an application, you will need to
'import pkg_resources' and then use a 'require()' call similar to one of
these examples, in order to select the desired version:

    pkg_resources.require("SQLAlchemy")  # latest installed version
    pkg_resources.require("SQLAlchemy==0.9.8")  # this exact version
    pkg_resources.require("SQLAlchemy>=0.9.8")  # this version or higher

Processing dependencies for sqlalchemy
Finished processing dependencies for sqlalchemy



$ sudo easy_install -m SQLAlchemy==0.9.8
Searching for SQLAlchemy==0.9.8
Best match: SQLAlchemy 0.9.8
Processing SQLAlchemy-0.9.8-py2.7.egg

Using /usr/local/lib/python2.7/dist-packages/SQLAlchemy-0.9.8-py2.7.egg

Because this distribution was installed --multi-version, before you can
import modules from this package in an application, you will need to
'import pkg_resources' and then use a 'require()' call similar to one of
these examples, in order to select the desired version:

    pkg_resources.require("SQLAlchemy")  # latest installed version
    pkg_resources.require("SQLAlchemy==0.9.8")  # this exact version
    pkg_resources.require("SQLAlchemy>=0.9.8")  # this version or higher

Processing dependencies for SQLAlchemy==0.9.8 Finished processing dependencies for SQLAlchemy==0.9.8

$ sudo rm /usr/local/lib/python2.7/dist-packages/SQLAlchemy-0.9.8-py2.7.egg/ -r

 

(完)