我正在尝试通过以下命令安装名为 blockdiag 的 python UML 工具:
sudo easy_install blockdiag
我收到以下错误,但无法弄清楚如何修复它。这是我第一次收到这种错误,如果您能告诉我如何解决此类错误,我将不胜感激。
Reading http://effbot.org/zone/pil-changes-115.htm
Download error: [Errno -2] Name or service not known -- Some packages may not be found!
Reading http://effbot.org/zone/pil-changes-115.htm
Reading http://effbot.org/downloads/#Imaging
Best match: PIL 1.1.7
Downloading http://effbot.org/media/downloads/PIL-1.1.7.tar.gz
Processing PIL-1.1.7.tar.gz
Running PIL-1.1.7/setup.py -q bdist_egg --dist-dir /tmp/easy_install-tx4P54/PIL-1.1.7/egg-dist-tmp-F4vgBr
WARNING: '' not a valid package name; please use only.-separated package names in setup.py
_imaging.c:75:20: error: Python.h: No such file or directory
In file included from libImaging/Imaging.h:14,
from _imaging.c:77:
答案1
您是否python-dev
安装了软件包?这就是 Python.h 的来源。
以下是您自己查找此信息的步骤:
运行以查找所有提供名称中apt-file search Python.h
包含的文件的软件包(您可能必须先安装 apt-file)。这会列出很多软件包,但大多数都提供类似这样的文件。提供 Python.h 文件的唯一软件包是 pythonX.X-dbg 和 pythonX.X-dev 软件包。现在,-dbg 软件包包含程序的调试版本,而 -dev 包含开发文件(例如 C 头文件),而 Python.h 就是这样的文件。Python.h
Symbol-Tables-In-Python.html
这样将软件包列表缩小到 python2.6-dev、python2.7-dev 和 python3.2-dev。检查哪个版本是规范版本的一种方法是简单地从软件包名称中删除版本号,然后检查是否存在apt-cache show python-dev
::
Package: python-dev
Priority: optional
Section: python
Installed-Size: 32
Maintainer: Ubuntu Developers <[email protected]>
Original-Maintainer: Matthias Klose <[email protected]>
Architecture: all
Source: python-defaults
Version: 2.7.2-7ubuntu2
Depends: python (= 2.7.2-7ubuntu2), python2.7-dev (>= 2.7.2-3~)
Filename: pool/main/p/python-defaults/python-dev_2.7.2-7ubuntu2_all.deb
Size: 1008
MD5sum: d8ef295ca23c3f46298daaa0ccb25403
SHA1: 057d3802fb2afb2a4f85906d65fcb2589568a377
SHA256: 1f5340056e70d6ff573e43f42365b1fd96cee7870ec6ed42c3be4eba6216a092
Description-en: header files and a static library for Python (default)
Header files, a static library and development tools for building
Python modules, extending the Python interpreter or embedding Python
in applications.
.
This package is a dependency package, which depends on Debian's default
Python version (currently v2.7).
Homepage: http://www.python.org/
Description-md5: 93a1917c3f17606b40377d0b737c6c92
Bugs: https://bugs.launchpad.net/ubuntu/+filebug
Origin: Ubuntu
Supported: 18m
该Depends:
行显示它将安装python2.7-dev,因此您只需安装python-dev即可。
由于我已经安装了正确的包,所以我可以使用locate Python.h
然后dpkg -S /usr/include/python2.7/Python.h
找到包含 Python.h 的包。