2012-11-04 79 views
2

我嘗試使用簡單安裝來安裝Scrapy。我安裝了Cython,它似乎工作,我安裝了libxml2表單http://www.lfd.uci.edu/~gohlke/pythonlibs/我改變了cygwinccompiler在此文章後scrapy installation error我仍然有一個錯誤,不知道下一步該怎麼做。此外,我不知道爲什麼會出現,這是Building without Cython我的Windows 7 32位和Python 2.7在Windows7下安裝Scrapy

C:\Users\t>easy_install -U Scrapy 
Searching for Scrapy 
Reading http://pypi.python.org/simple/Scrapy/ 
Reading http://scrapy.org 
Best match: scrapy 0.16.1 
Processing scrapy-0.16.1-py2.7.egg 
scrapy 0.16.1 is already the active version in easy-install.pth 
Installing scrapy script to C:\Python27\Scripts 
Installing scrapy.bat script to C:\Python27\Scripts 

Using c:\python27\lib\site-packages\scrapy-0.16.1-py2.7.egg 
Processing dependencies for Scrapy 
Searching for lxml 
Reading http://pypi.python.org/simple/lxml/ 
Reading http://codespeak.net/lxml 
Best match: lxml 3.0.1 
Downloading http://lxml.de/files/lxml-3.0.1.tgz 
Processing lxml-3.0.1.tgz 
Running lxml-3.0.1\setup.py -q bdist_egg --dist-dir c:\users\t\appdata\lo 
cal\temp\easy_install-7mgdch\lxml-3.0.1\egg-dist-tmp-686xm8 
Building lxml version 3.0.1. 
Building without Cython. 
ERROR: 'xslt-config' is not recognized as an internal or external command, 
operable program or batch file. 

** make sure the development packages of libxml2 and libxslt are installed ** 

Using build configuration of libxslt 
warning: no files found matching '*.txt' under directory 'src\lxml\tests' 
In file included from src\lxml\lxml.etree.c:254:0: 
c:\users\t\appdata\local\temp\easy_install-7mgdch\lxml-3.0.1\src\lxml\inc 
ludes/etree_defs.h:9:31: fatal error: libxml/xmlversion.h: No such file or direc 
tory 
compilation terminated. 
error: Setup script exited with error: command 'gcc' failed with exit status 1 
+0

顯然,您需要安裝libxml2和libxslt的開發包。 – pydsigner

+0

我已經安裝了它們 – tomasz74

+0

您是否閱讀過http://doc.scrapy.org/en/latest/intro/install.html? – pydsigner

回答

4

不知道,如果你已經解決了它。我今天就遇到了這個問題,這裏是我如何解決它,直接搶了lxml的二進制:http://www.lfd.uci.edu/~gohlke/pythonlibs/#lxml

和PIP安裝Scrapy某種程度上忽略你安裝並嘗試重新建立的事實,所以它會失敗。但是,在運行pip install的目錄中會有一個'build'目錄,在那裏找到'Scrapy \ setup.py'。

現在發現在該文件的底部:

setup_args [「install_requires」] = ...

,並刪除LXML和pyopenssl(你很可能需要直接,如果你是安裝二進制在windows上工作,這可以在這裏找到:http://slproweb.com/products/Win32OpenSSL.html

運行pip再次從同一目錄安裝Scrapy,你應該很好去。

+0

感謝那 – tomasz74

+0

它爲你工作托馬斯?如果可以,請您批准答案? – airfang

+0

這應該起作用了,但我不確定它爲什麼不適合我。點子不斷嘗試重新安裝lxml。這可能是我的virtualenv設置。無論如何,我使用'''pip install --no-deps Scrapy'''作爲替代。 – lastoneisbearfood

0

我有同樣的問題(Windows 10,Python 2.7.12),這裏是什麼對我有用。 我用「pip install scrapy」而不是「easy_install」。如果你沒有安裝2.7的點子,這裏是official documentation。 如果仍然不起作用,您可以嘗試以下這些:manual installation directions