本文地址: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
(完)