尝试在Python2.6 virtualenv中安装PIL的gcc错误

我用–no-site-packages选项创build了一个virtualenv。 我试图安装PIL时出现错误:

http://pastebin.com/SVqxs1sC

... error: command '/usr/bin/gcc' failed with exit status 1 ---------------------------------------- Command /home/dustin/.virtualenvs/django1.2/bin/python -c "import setuptools; __file__='/home/dustin/.virtualenvs/django1.2/build/pil/setup.py'; execfile('/home/dustin/.virtualenvs/django1.2/build/pil/setup.py')" install --single-version-externally-managed --record /tmp/pip-t_oikl-record/install-record.txt --install-headers /home/dustin/.virtualenvs/django1.2/include/site/python2.6 failed with error code 1 Exception information: Traceback (most recent call last): File "/home/dustin/.virtualenvs/django1.2/lib/python2.6/site-packages/pip-0.7.2-py2.6.egg/pip/basecommand.py", line 120, in main self.run(options, args) File "/home/dustin/.virtualenvs/django1.2/lib/python2.6/site-packages/pip-0.7.2-py2.6.egg/pip/commands/install.py", line 165, in run requirement_set.install(install_options) File "/home/dustin/.virtualenvs/django1.2/lib/python2.6/site-packages/pip-0.7.2-py2.6.egg/pip/req.py", line 1243, in install requirement.install(install_options) File "/home/dustin/.virtualenvs/django1.2/lib/python2.6/site-packages/pip-0.7.2-py2.6.egg/pip/req.py", line 540, in install cwd=self.source_dir, filter_stdout=self._filter_install, show_stdout=False) File "/home/dustin/.virtualenvs/django1.2/lib/python2.6/site-packages/pip-0.7.2-py2.6.egg/pip/__init__.py", line 226, in call_subprocess % (command_desc, proc.returncode)) InstallationError: Command /home/dustin/.virtualenvs/django1.2/bin/python -c "import setuptools; __file__='/home/dustin/.virtualenvs/django1.2/build/pil/setup.py'; execfile('/home/dustin/.virtualenvs/django1.2/build/pil/setup.py')" install --single-version-externally-managed --record /tmp/pip-t_oikl-record/install-record.txt --install-headers /home/dustin/.virtualenvs/django1.2/include/site/python2.6 failed with error code 1 

有人可以帮我弄这个吗?

我正在运行Ubuntu 10.04(64位)

你需要安装python-dev包。

 sudo apt-get install python-dev 

看看你的pastebin链接上的完整列表

 _imaging.c:75:20: error: Python.h: No such file or directory 

是问题。

gcc命令行有

 -I/usr/include/python2.6 

那么这就是我们期望find它的地方,那就是我在Mandriva系统上的地方。

也许你已经安装了python,但是不包含相应的“-devel”版本的开发库?

sudo apt-get install python-dev – 非常好,但是如果你在你的主机系统上使用了很less的python,python2.6是默认的。

如果您尝试:

  virtualenv -p python2.7 

,转到bin目录,说源激活,比:

 pip install PIL 

你会得到这样的错误:_imaging.c:75:20:error:Python.h:没有这样的文件或目录

你应该说!:

 sudo apt-get install python2.7-dev