环境:win7、Python 2.7.12、PyCharm 2016.3
Requirement already satisfied (use --upgrade to upgrade): scrapy in d:\python27\lib\site-packages\scrapy-1.2.2-py2.7.eggCollecting Twisted>=10.0.0 (from scrapy) Downloading https://pypi.doubanio.com/packages/dc/c0/a0114a6d7fa211c0904b0de931e8cafb5210ad824996cc6a9d67f3bae22c/Twisted-16.6.0.tar.bz2 (3.0MB)Requirement already satisfied (use --upgrade to upgrade): w3lib>=1.15.0 in d:\python27\lib\site-packages (from scrapy)Requirement already satisfied (use --upgrade to upgrade): queuelib in d:\python27\lib\site-packages (from scrapy)Collecting lxml (from scrapy) Downloading https://pypi.doubanio.com/packages/14/51/61462e59ab58575fe0d679ab2d31ec73cd49b26182c6ece3d9379faccfd7/lxml-3.7.0.tar.gz (3.8MB)Requirement already satisfied (use --upgrade to upgrade): pyOpenSSL in d:\python27\lib\site-packages (from scrapy)Requirement already satisfied (use --upgrade to upgrade): cssselect>=0.9 in d:\python27\lib\site-packages (from scrapy)Requirement already satisfied (use --upgrade to upgrade): six>=1.5.2 in d:\python27\lib\site-packages (from scrapy)Requirement already satisfied (use --upgrade to upgrade): parsel>=0.9.3 in d:\python27\lib\site-packages\parsel-1.1.0-py2.7.egg (from scrapy)Requirement already satisfied (use --upgrade to upgrade): PyDispatcher>=2.0.5 in d:\python27\lib\site-packages\pydispatcher-2.0.5-py2.7.egg (from scrapy)Requirement already satisfied (use --upgrade to upgrade): service-identity in d:\python27\lib\site-packages (from scrapy)Collecting zope.interface>=3.6.0 (from Twisted>=10.0.0->scrapy) Downloading https://pypi.doubanio.com/packages/44/af/cea1e18bc0d3be0e0824762d3236f0e61088eeed75287e7b854d65ec9916/zope.interface-4.3.3.tar.gz (150kB)Collecting constantly>=15.1 (from Twisted>=10.0.0->scrapy) Downloading https://pypi.doubanio.com/packages/b9/65/48c1909d0c0aeae6c10213340ce682db01b48ea900a7d9fce7a7910ff318/constantly-15.1.0-py2.py3-none-any.whlCollecting incremental>=16.10.1 (from Twisted>=10.0.0->scrapy) Downloading https://pypi.doubanio.com/packages/b5/72/f4246320648bbe0f8c16dcebe1560e359a3a0631839f8d963ea8ff18caaf/incremental-16.10.1-py2.py3-none-any.whlRequirement already satisfied (use --upgrade to upgrade): cryptography>=1.3.4 in d:\python27\lib\site-packages (from pyOpenSSL->scrapy)Requirement already satisfied (use --upgrade to upgrade): pyasn1-modules in d:\python27\lib\site-packages (from service-identity->scrapy)Requirement already satisfied (use --upgrade to upgrade): attrs in d:\python27\lib\site-packages (from service-identity->scrapy)Requirement already satisfied (use --upgrade to upgrade): pyasn1 in d:\python27\lib\site-packages (from service-identity->scrapy)Requirement already satisfied (use --upgrade to upgrade): setuptools in d:\python27\lib\site-packages (from zope.interface>=3.6.0->Twisted>=10.0.0->scrapy)Requirement already satisfied (use --upgrade to upgrade): enum34 in d:\python27\lib\site-packages (from cryptography>=1.3.4->pyOpenSSL->scrapy)Requirement already satisfied (use --upgrade to upgrade): ipaddress in d:\python27\lib\site-packages (from cryptography>=1.3.4->pyOpenSSL->scrapy)Requirement already satisfied (use --upgrade to upgrade): idna>=2.0 in d:\python27\lib\site-packages (from cryptography>=1.3.4->pyOpenSSL->scrapy)Requirement already satisfied (use --upgrade to upgrade): cffi>=1.4.1 in d:\python27\lib\site-packages (from cryptography>=1.3.4->pyOpenSSL->scrapy)Requirement already satisfied (use --upgrade to upgrade): pycparser in d:\python27\lib\site-packages (from cffi>=1.4.1->cryptography>=1.3.4->pyOpenSSL->scrapy)Installing collected packages: zope.interface, constantly, incremental, Twisted, lxml Running setup.py install for zope.interface: started Running setup.py install for zope.interface: finished with status 'done' Running setup.py install for Twisted: started Running setup.py install for Twisted: finished with status 'done' Running setup.py install for lxml: started Running setup.py install for lxml: finished with status 'error' Complete output from command D:\Python27\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\Administrator\\AppData\\Local\\Temp\\pycharm-packaging\\lxml\\setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record c:\users\admini~1\appdata\local\temp\pip-ju1hmw-record\install-record.txt --single-version-externally-managed --compile: Building lxml version 3.7.0. Building without Cython. ERROR: 'xslt-config' 不是内部或外部命令,也不是可运行的程序 或批处理文件。 ** make sure the development packages of libxml2 and libxslt are installed ** Using build configuration of libxslt running install running build running build_py creating build creating build\lib.win32-2.7 creating build\lib.win32-2.7\lxml copying src\lxml\builder.py -> build\lib.win32-2.7\lxml copying src\lxml\cssselect.py -> build\lib.win32-2.7\lxml copying src\lxml\doctestcompare.py -> build\lib.win32-2.7\lxml copying src\lxml\ElementInclude.py -> build\lib.win32-2.7\lxml copying src\lxml\pyclasslookup.py -> build\lib.win32-2.7\lxml copying src\lxml\sax.py -> build\lib.win32-2.7\lxml copying src\lxml\usedoctest.py -> build\lib.win32-2.7\lxml copying src\lxml\_elementpath.py -> build\lib.win32-2.7\lxml copying src\lxml\__init__.py -> build\lib.win32-2.7\lxml creating build\lib.win32-2.7\lxml\includes copying src\lxml\includes\__init__.py -> build\lib.win32-2.7\lxml\includes creating build\lib.win32-2.7\lxml\html copying src\lxml\html\builder.py -> build\lib.win32-2.7\lxml\html copying src\lxml\html\clean.py -> build\lib.win32-2.7\lxml\html copying src\lxml\html\defs.py -> build\lib.win32-2.7\lxml\html copying src\lxml\html\diff.py -> build\lib.win32-2.7\lxml\html copying src\lxml\html\ElementSoup.py -> build\lib.win32-2.7\lxml\html copying src\lxml\html\formfill.py -> build\lib.win32-2.7\lxml\html copying src\lxml\html\html5parser.py -> build\lib.win32-2.7\lxml\html copying src\lxml\html\soupparser.py -> build\lib.win32-2.7\lxml\html copying src\lxml\html\usedoctest.py -> build\lib.win32-2.7\lxml\html copying src\lxml\html\_diffcommand.py -> build\lib.win32-2.7\lxml\html copying src\lxml\html\_html5builder.py -> build\lib.win32-2.7\lxml\html copying src\lxml\html\_setmixin.py -> build\lib.win32-2.7\lxml\html copying src\lxml\html\__init__.py -> build\lib.win32-2.7\lxml\html creating build\lib.win32-2.7\lxml\isoschematron copying src\lxml\isoschematron\__init__.py -> build\lib.win32-2.7\lxml\isoschematron copying src\lxml\lxml.etree.h -> build\lib.win32-2.7\lxml copying src\lxml\lxml.etree_api.h -> build\lib.win32-2.7\lxml copying src\lxml\includes\c14n.pxd -> build\lib.win32-2.7\lxml\includes copying src\lxml\includes\config.pxd -> build\lib.win32-2.7\lxml\includes copying src\lxml\includes\dtdvalid.pxd -> build\lib.win32-2.7\lxml\includes copying src\lxml\includes\etreepublic.pxd -> build\lib.win32-2.7\lxml\includes copying src\lxml\includes\htmlparser.pxd -> build\lib.win32-2.7\lxml\includes copying src\lxml\includes\relaxng.pxd -> build\lib.win32-2.7\lxml\includes copying src\lxml\includes\schematron.pxd -> build\lib.win32-2.7\lxml\includes copying src\lxml\includes\tree.pxd -> build\lib.win32-2.7\lxml\includes copying src\lxml\includes\uri.pxd -> build\lib.win32-2.7\lxml\includes copying src\lxml\includes\xinclude.pxd -> build\lib.win32-2.7\lxml\includes copying src\lxml\includes\xmlerror.pxd -> build\lib.win32-2.7\lxml\includes copying src\lxml\includes\xmlparser.pxd -> build\lib.win32-2.7\lxml\includes copying src\lxml\includes\xmlschema.pxd -> build\lib.win32-2.7\lxml\includes copying src\lxml\includes\xpath.pxd -> build\lib.win32-2.7\lxml\includes copying src\lxml\includes\xslt.pxd -> build\lib.win32-2.7\lxml\includes copying src\lxml\includes\etree_defs.h -> build\lib.win32-2.7\lxml\includes copying src\lxml\includes\lxml-version.h -> build\lib.win32-2.7\lxml\includes creating build\lib.win32-2.7\lxml\isoschematron\resources creating build\lib.win32-2.7\lxml\isoschematron\resources\rng copying src\lxml\isoschematron\resources\rng\iso-schematron.rng -> build\lib.win32-2.7\lxml\isoschematron\resources\rng creating build\lib.win32-2.7\lxml\isoschematron\resources\xsl copying src\lxml\isoschematron\resources\xsl\RNG2Schtrn.xsl -> build\lib.win32-2.7\lxml\isoschematron\resources\xsl copying src\lxml\isoschematron\resources\xsl\XSD2Schtrn.xsl -> build\lib.win32-2.7\lxml\isoschematron\resources\xsl creating build\lib.win32-2.7\lxml\isoschematron\resources\xsl\iso-schematron-xslt1 copying src\lxml\isoschematron\resources\xsl\iso-schematron-xslt1\iso_abstract_expand.xsl -> build\lib.win32-2.7\lxml\isoschematron\resources\xsl\iso-schematron-xslt1 copying src\lxml\isoschematron\resources\xsl\iso-schematron-xslt1\iso_dsdl_include.xsl -> build\lib.win32-2.7\lxml\isoschematron\resources\xsl\iso-schematron-xslt1 copying src\lxml\isoschematron\resources\xsl\iso-schematron-xslt1\iso_schematron_message.xsl -> build\lib.win32-2.7\lxml\isoschematron\resources\xsl\iso-schematron-xslt1 copying src\lxml\isoschematron\resources\xsl\iso-schematron-xslt1\iso_schematron_skeleton_for_xslt1.xsl -> build\lib.win32-2.7\lxml\isoschematron\resources\xsl\iso-schematron-xslt1 copying src\lxml\isoschematron\resources\xsl\iso-schematron-xslt1\iso_svrl_for_xslt1.xsl -> build\lib.win32-2.7\lxml\isoschematron\resources\xsl\iso-schematron-xslt1 copying src\lxml\isoschematron\resources\xsl\iso-schematron-xslt1\readme.txt -> build\lib.win32-2.7\lxml\isoschematron\resources\xsl\iso-schematron-xslt1 warning: build_py: byte-compiling is disabled, skipping. running build_ext building 'lxml.etree' extension creating build\temp.win32-2.7 creating build\temp.win32-2.7\Release creating build\temp.win32-2.7\Release\src creating build\temp.win32-2.7\Release\src\lxml C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\BIN\cl.exe /c /nologo /Ox /MD /W3 /GS- /DNDEBUG -Isrc\lxml\includes -ID:\Python27\include -ID:\Python27\PC /Tcsrc\lxml\lxml.etree.c /Fobuild\temp.win32-2.7\Release\src\lxml\lxml.etree.obj -w cl: 命令行 warning D9025 :正在重写“/W3”(用“/w”) lxml.etree.c src\lxml\includes\etree_defs.h(14) : fatal error C1083: 无法打开包括文件:“libxml/xmlversion.h”: No such file or directory Compile failed: command 'C:\\Program Files (x86)\\Microsoft Visual Studio 9.0\\VC\\BIN\\cl.exe' failed with exit status 2 creating users creating users\admini~1 creating users\admini~1\appdata creating users\admini~1\appdata\local creating users\admini~1\appdata\local\temp C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\BIN\cl.exe /c /nologo /Ox /MD /W3 /GS- /DNDEBUG -I/usr/include/libxml2 /Tcc:\users\admini~1\appdata\local\temp\xmlXPathInittloph7.c /Fousers\admini~1\appdata\local\temp\xmlXPathInittloph7.obj xmlXPathInittloph7.c c:\users\admini~1\appdata\local\temp\xmlXPathInittloph7.c(1) : fatal error C1083: 无法打开包括文件:“libxml/xpath.h”: No such file or directory ********************************************************************************* Could not find function xmlCheckVersion in library libxml2. Is libxml2 installed? ********************************************************************************* error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio 9.0\\VC\\BIN\\cl.exe' failed with exit status 2 ----------------------------------------Command "D:\Python27\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\Administrator\\AppData\\Local\\Temp\\pycharm-packaging\\lxml\\setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record c:\users\admini~1\appdata\local\temp\pip-ju1hmw-record\install-record.txt --single-version-externally-managed --compile" failed with error code 1 in C:\Users\Administrator\AppData\Local\Temp\pycharm-packaging\lxml\You are using pip version 8.1.1, however version 9.0.1 is available.You should consider upgrading via the 'python -m pip install --upgrade pip' command.
命令行pip和easy_install装lxml,都失败。
1、下载
2、手动安装lxml的exe的二进制包
3、使用wheel安装
D:\Python27\Scripts>pip install lxml-3.7.0-cp27-cp27m-win_amd64.whl
lxml-3.7.0-cp27-cp27m-win_amd64.whl is not a supported wheel on this platform.You are using pip version 8.1.1, however version 9.0.1 is available.You should consider upgrading via the 'python -m pip install --upgrade pip' command.D:\Python27\Scripts>
参考:
https://www.v2ex.com/t/186114
https://www.zhihu.com/question/26857761
https://www.zhihu.com/question/30047496
http://blog.csdn.net/xibeichengf/article/details/50479151
http://www.cnblogs.com/neillee/p/5903856.html
https://www.biaodianfu.com/install-scrapy-on-windows.html
http://blog.csdn.net/changdejie/article/details/17997299