Python 重复安装scrapy和lxml失败

Python 重复安装scrapy和lxml失败,python,ubuntu,scrapy,lxml,Python,Ubuntu,Scrapy,Lxml,我以前使用过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

我以前使用过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
我试图在下面安装它,但当我调用python的已安装模块时,scrapy仍然没有被列出

有什么想法吗?谢谢,非常感谢


如果有必要的话,我会使用Ubuntu 13.10。我试过的其他模块都安装得很好(尽管我只安装了少数模块)。

我在Ubuntu 14.04中也遇到了同样的问题。我已经用@jdigital链接的页面说明和@user3115915指向的openssl开发库解决了这个问题。只是为了帮助别人:

sudo apt-get install libxslt1-dev libxslt1.1 libxml2-dev libxml2 libssl-dev
sudo pip install scrapy

在我的例子中,我解决了安装Manuel提到的所有库以及额外的库:libffi dev的问题


更新自@Mario C.和@Manuel

以下是命令:

sudo apt-get install libxslt1-dev libxslt1.1 libxml2-dev libxml2 libssl-dev libffi-dev
sudo pip install scrapy 

对于scrapy,调试日志中是否有其他信息?你安装了OpenSSL吗?@jdigital holy crap,谢谢你的OpenSSL提示!我安装了它,但没有安装开发库。把它改成那样就成功了。Phew.hey@user3115915你能链接到开发库吗?遇到同样的问题,无法修复…我的系统上缺少的其他东西:
python-dev
(或者在我的情况下是
python3.4-dev
,因为python2.7安装了python-dev)