我以前使用过Anaconda来处理python,但现在开始使用虚拟环境。
我设置了virtualenv和virtualenvwrapper,并一直在尝试为我想要尝试的项目添加模块,特别是scrapy和lxml。
每次pip安装时,我都会遇到一个错误。
对于scrapy:
File "/home/philip/Envs/venv/local/lib/python2.7/site-packages/setuptools/command/easy_install.py", line 1003, in run_setup
raise DistutilsError("Setup script exited with %s" % (v.args[0],))
distutils.errors.DistutilsError: Setup script exited with error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
---------------------------------------
Cleaning up...
Command python setup.py egg_info failed with error code 1 in /home/philip/Envs/venv/build/cryptography
Storing debug log for failure in /home/philip/.pip/pip.log
对于lxml:
In file included from src/lxml/lxml.etree.c:346:0:
/home/philip/Envs/venv/build/lxml/src/lxml/includes/etree_defs.h:9:31: fatal error: libxml/xmlversion.h: No such file or directory
include "libxml/xmlversion.h"
^
compilation terminated.
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
----------------------------------------
Cleaning up... Command /home/philip/Envs/venv/bin/python -c "import setuptools, tokenize;__file__='/home/philip/Envs/venv/build/lxml/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-zIsPdl-record/install-record.txt
--single-version-externally-managed --compile --install-headers /home/philip/Envs/venv/include/site/python2.7 failed with error code 1 in /home/philip/Envs/venv/build/lxml Storing debug log for failure in /home/philip/.pip/pip.log
我试图在scrapy's documentation之后安装它,但是当我调用python的已安装模块时,仍然没有列出scrapy。
有什么想法吗?谢谢——非常感谢!
如果重要的话,我在Ubuntu 13.10上。我试过的其他模块安装得很好(尽管我只安装了一小部分)。
我在Ubuntu 14.04中也遇到了同样的问题。我已经用@jdigital链接的页面和@user3115915指向的openssl dev库的指令解决了这个问题。只是为了帮助别人:
在我的例子中,我解决了安装Manuel提到的所有库以及额外库libffi dev的问题
https://askubuntu.com/questions/499714/error-installing-scrapy-in-virtualenv-using-pip
从@Mario C.和@Manuel更新
以下是命令:
相关问题 更多 >
编程相关推荐