开发者

gcc error trying to install PIL in a Python2.6 virtualenv

I have created a virtualenv with the --no-site-packages option. I get an error trying to install 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/basecomm开发者_StackOverflow社区and.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

Can someone help me with this?

I'm running Ubuntu 10.04 (64 bit)


You need to install python-dev package.

sudo apt-get install python-dev


Looking at the full listing on your pastebin link the line

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

is the problem.

The gcc command line has

-I/usr/include/python2.6

there so that would be where it would expect to find it and that's where it is on my Mandriva system.

Perhaps you have python installed but not the development libraries which would be in the corresponding "-devel" version of the package?


sudo apt-get install python-dev - is very good, but if you use few pythons on your host system, and python2.6 is default.

If you try to:

 virtualenv -p python2.7

, go to the bin directory, say source activate, than:

pip install PIL

You get error like this: _imaging.c:75:20: error: Python.h: No such file or directory

You should say!:

sudo apt-get install python2.7-dev
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜