2

簡単インストールを使用してScrapyをインストールしようとしています。Cython をインストールしましたが、動作しているようです。libxml2 フォームhttp://www.lfd.uci.edu/~gohlke/pythonlibs/インストールcygwinccompilerしました次に行います。また、Windows 7 32 ビットと Python 2.7 を使用 している理由がわかりません。Building without Cython

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
4

2 に答える 2

4

すでに解決したかどうかはわかりません。私は今日この問題に遭遇しました。これを解決した方法は次のとおりです。lxml バイナリを直接取得します: http://www.lfd.uci.edu/~gohlke/pythonlibs/#lxml

と pip install Scrapy は、インストールされているという事実をどういうわけか無視して、再度ビルドしようとするため、失敗します。ただし、pip install を実行するディレクトリには「build」ディレクトリがあり、そこに「Scrapy\setup.py」があります。

ファイルの下部にある次のファイルを見つけます。

setup_args['install_requires'] = ...

lxml と pyopenssl を削除します (Windows で作業している場合は、バイナリを直接インストールする必要がある可能性が高く、ここで見つけることができます: http://slproweb.com/products/Win32OpenSSL.html )

同じディレクトリから pip install Scrapy を再度実行すると、準備完了です。

于 2012-11-25T09:24:05.960 に答える
0

私は同じ問題(Windows 10、Python 2.7.12)を抱えていましたが、ここでうまくいきました。「easy_install」の代わりに「pip install Scrapy」を使用しました。2.7 用の pip がインストールされていない場合は、こちらの公式ドキュメントを参照してください。それでもうまくいかない場合は、次の手動インストール手順に従ってみてください。

于 2016-08-03T04:32:12.590 に答える