环境:win7、Python 2.7.12、PyCharm 2016.3
Requirement already satisfied (use --upgrade to upgrade): scrapy in d:python27libsite-packagesscrapy-1.2.2-py2.7.egg Collecting 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:python27libsite-packages (from scrapy) Requirement already satisfied (use --upgrade to upgrade): queuelib in d:python27libsite-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:python27libsite-packages (from scrapy) Requirement already satisfied (use --upgrade to upgrade): cssselect>=0.9 in d:python27libsite-packages (from scrapy) Requirement already satisfied (use --upgrade to upgrade): six>=1.5.2 in d:python27libsite-packages (from scrapy) Requirement already satisfied (use --upgrade to upgrade): parsel>=0.9.3 in d:python27libsite-packagesparsel-1.1.0-py2.7.egg (from scrapy) Requirement already satisfied (use --upgrade to upgrade): PyDispatcher>=2.0.5 in d:python27libsite-packagespydispatcher-2.0.5-py2.7.egg (from scrapy) Requirement already satisfied (use --upgrade to upgrade): service-identity in d:python27libsite-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.whl Collecting 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.whl Requirement already satisfied (use --upgrade to upgrade): cryptography>=1.3.4 in d:python27libsite-packages (from pyOpenSSL->scrapy) Requirement already satisfied (use --upgrade to upgrade): pyasn1-modules in d:python27libsite-packages (from service-identity->scrapy) Requirement already satisfied (use --upgrade to upgrade): attrs in d:python27libsite-packages (from service-identity->scrapy) Requirement already satisfied (use --upgrade to upgrade): pyasn1 in d:python27libsite-packages (from service-identity->scrapy) Requirement already satisfied (use --upgrade to upgrade): setuptools in d:python27libsite-packages (from zope.interface>=3.6.0->Twisted>=10.0.0->scrapy) Requirement already satisfied (use --upgrade to upgrade): enum34 in d:python27libsite-packages (from cryptography>=1.3.4->pyOpenSSL->scrapy) Requirement already satisfied (use --upgrade to upgrade): ipaddress in d:python27libsite-packages (from cryptography>=1.3.4->pyOpenSSL->scrapy) Requirement already satisfied (use --upgrade to upgrade): idna>=2.0 in d:python27libsite-packages (from cryptography>=1.3.4->pyOpenSSL->scrapy) Requirement already satisfied (use --upgrade to upgrade): cffi>=1.4.1 in d:python27libsite-packages (from cryptography>=1.3.4->pyOpenSSL->scrapy) Requirement already satisfied (use --upgrade to upgrade): pycparser in d:python27libsite-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:Python27python.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(' ', ' '), __file__, 'exec'))" install --record c:usersadmini~1appdatalocal emppip-ju1hmw-recordinstall-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 buildlib.win32-2.7 creating buildlib.win32-2.7lxml copying srclxmluilder.py -> buildlib.win32-2.7lxml copying srclxmlcssselect.py -> buildlib.win32-2.7lxml copying srclxmldoctestcompare.py -> buildlib.win32-2.7lxml copying srclxmlElementInclude.py -> buildlib.win32-2.7lxml copying srclxmlpyclasslookup.py -> buildlib.win32-2.7lxml copying srclxmlsax.py -> buildlib.win32-2.7lxml copying srclxmlusedoctest.py -> buildlib.win32-2.7lxml copying srclxml\_elementpath.py -> buildlib.win32-2.7lxml copying srclxml\__init__.py -> buildlib.win32-2.7lxml creating buildlib.win32-2.7lxmlincludes copying srclxmlincludes\__init__.py -> buildlib.win32-2.7lxmlincludes creating buildlib.win32-2.7lxmlhtml copying srclxmlhtmluilder.py -> buildlib.win32-2.7lxmlhtml copying srclxmlhtmlclean.py -> buildlib.win32-2.7lxmlhtml copying srclxmlhtmldefs.py -> buildlib.win32-2.7lxmlhtml copying srclxmlhtmldiff.py -> buildlib.win32-2.7lxmlhtml copying srclxmlhtmlElementSoup.py -> buildlib.win32-2.7lxmlhtml copying srclxmlhtmlformfill.py -> buildlib.win32-2.7lxmlhtml copying srclxmlhtmlhtml5parser.py -> buildlib.win32-2.7lxmlhtml copying srclxmlhtmlsoupparser.py -> buildlib.win32-2.7lxmlhtml copying srclxmlhtmlusedoctest.py -> buildlib.win32-2.7lxmlhtml copying srclxmlhtml\_diffcommand.py -> buildlib.win32-2.7lxmlhtml copying srclxmlhtml\_html5builder.py -> buildlib.win32-2.7lxmlhtml copying srclxmlhtml\_setmixin.py -> buildlib.win32-2.7lxmlhtml copying srclxmlhtml\__init__.py -> buildlib.win32-2.7lxmlhtml creating buildlib.win32-2.7lxmlisoschematron copying srclxmlisoschematron\__init__.py -> buildlib.win32-2.7lxmlisoschematron copying srclxmllxml.etree.h -> buildlib.win32-2.7lxml copying srclxmllxml.etree_api.h -> buildlib.win32-2.7lxml copying srclxmlincludesc14n.pxd -> buildlib.win32-2.7lxmlincludes copying srclxmlincludesconfig.pxd -> buildlib.win32-2.7lxmlincludes copying srclxmlincludesdtdvalid.pxd -> buildlib.win32-2.7lxmlincludes copying srclxmlincludesetreepublic.pxd -> buildlib.win32-2.7lxmlincludes copying srclxmlincludeshtmlparser.pxd -> buildlib.win32-2.7lxmlincludes copying srclxmlincludes elaxng.pxd -> buildlib.win32-2.7lxmlincludes copying srclxmlincludesschematron.pxd -> buildlib.win32-2.7lxmlincludes copying srclxmlincludes ree.pxd -> buildlib.win32-2.7lxmlincludes copying srclxmlincludesuri.pxd -> buildlib.win32-2.7lxmlincludes copying srclxmlincludesxinclude.pxd -> buildlib.win32-2.7lxmlincludes copying srclxmlincludesxmlerror.pxd -> buildlib.win32-2.7lxmlincludes copying srclxmlincludesxmlparser.pxd -> buildlib.win32-2.7lxmlincludes copying srclxmlincludesxmlschema.pxd -> buildlib.win32-2.7lxmlincludes copying srclxmlincludesxpath.pxd -> buildlib.win32-2.7lxmlincludes copying srclxmlincludesxslt.pxd -> buildlib.win32-2.7lxmlincludes copying srclxmlincludesetree_defs.h -> buildlib.win32-2.7lxmlincludes copying srclxmlincludeslxml-version.h -> buildlib.win32-2.7lxmlincludes creating buildlib.win32-2.7lxmlisoschematron esources creating buildlib.win32-2.7lxmlisoschematron esources ng copying srclxmlisoschematron esources ngiso-schematron.rng -> buildlib.win32-2.7lxmlisoschematron esources ng creating buildlib.win32-2.7lxmlisoschematron esourcesxsl copying srclxmlisoschematron esourcesxslRNG2Schtrn.xsl -> buildlib.win32-2.7lxmlisoschematron esourcesxsl copying srclxmlisoschematron esourcesxslXSD2Schtrn.xsl -> buildlib.win32-2.7lxmlisoschematron esourcesxsl creating buildlib.win32-2.7lxmlisoschematron esourcesxsliso-schematron-xslt1 copying srclxmlisoschematron esourcesxsliso-schematron-xslt1iso_abstract_expand.xsl -> buildlib.win32-2.7lxmlisoschematron esourcesxsliso-schematron-xslt1 copying srclxmlisoschematron esourcesxsliso-schematron-xslt1iso_dsdl_include.xsl -> buildlib.win32-2.7lxmlisoschematron esourcesxsliso-schematron-xslt1 copying srclxmlisoschematron esourcesxsliso-schematron-xslt1iso_schematron_message.xsl -> buildlib.win32-2.7lxmlisoschematron esourcesxsliso-schematron-xslt1 copying srclxmlisoschematron esourcesxsliso-schematron-xslt1iso_schematron_skeleton_for_xslt1.xsl -> buildlib.win32-2.7lxmlisoschematron esourcesxsliso-schematron-xslt1 copying srclxmlisoschematron esourcesxsliso-schematron-xslt1iso_svrl_for_xslt1.xsl -> buildlib.win32-2.7lxmlisoschematron esourcesxsliso-schematron-xslt1 copying srclxmlisoschematron esourcesxsliso-schematron-xslt1 eadme.txt -> buildlib.win32-2.7lxmlisoschematron esourcesxsliso-schematron-xslt1 warning: build_py: byte-compiling is disabled, skipping. running build_ext building 'lxml.etree' extension creating build emp.win32-2.7 creating build emp.win32-2.7Release creating build emp.win32-2.7Releasesrc creating build emp.win32-2.7Releasesrclxml C:Program Files (x86)Microsoft Visual Studio 9.0VCBINcl.exe /c /nologo /Ox /MD /W3 /GS- /DNDEBUG -Isrclxmlincludes -ID:Python27include -ID:Python27PC /Tcsrclxmllxml.etree.c /Fobuild emp.win32-2.7Releasesrclxmllxml.etree.obj -w cl: 命令行 warning D9025 :正在重写“/W3”(用“/w”) lxml.etree.c srclxmlincludesetree_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 usersadmini~1 creating usersadmini~1appdata creating usersadmini~1appdatalocal creating usersadmini~1appdatalocal emp C:Program Files (x86)Microsoft Visual Studio 9.0VCBINcl.exe /c /nologo /Ox /MD /W3 /GS- /DNDEBUG -I/usr/include/libxml2 /Tcc:usersadmini~1appdatalocal empxmlXPathInittloph7.c /Fousersadmini~1appdatalocal empxmlXPathInittloph7.obj xmlXPathInittloph7.c c:usersadmini~1appdatalocal empxmlXPathInittloph7.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:Python27python.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(' ', ' '), __file__, 'exec'))" install --record c:usersadmini~1appdatalocal emppip-ju1hmw-recordinstall-record.txt --single-version-externally-managed --compile" failed with error code 1 in C:UsersAdministratorAppDataLocalTemppycharm-packaginglxml 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、下载Microsoft Visual C++ Compiler for Python 2.7
2、手动安装lxml的exe的二进制包
3、使用wheel安装
D:Python27Scripts>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' comm
and.
D:Python27Scripts>
参考:
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