最近尝试用Scrapy框架编写web爬虫,在安装过程中遇到一些问题!!!
pip install scrapyl
出现了这样一个问题:
error: Microsoft Visual C++ 9.0 is required (Unable to find vcvarsall.bat). Get it from http://aka.ms/vcpython27
字面意义理解,是需要Microsoft Visual C++ 9.0,而我的电脑中已经安装了Visual Studio 2010了呀。后来在网上查,原来是在windows下使用pip安装包的时候需要机器装有vs2008,别的版本还不行。如果不想安装VS2008,可以安装
安装完这个Visual C++的文件后,再次安装lxml,竟然还是错误。不过这次的错误和上一次有所区别,错误提示内容为:
********************************************************************************* Could not find function xmlCheckVersion in library libxml2. Is libxml2 installed? *********************************************************************************
和
src\lxml\includes\etree_defs.h(14) : fatal error C1083: Cannot open include file: 'libxml/xmlversion.h': No such file or directory c:\users\xzfeng\appdata\local\temp\xmlXPathInit0wevj7.c(1) : fatal error C1083: Cannot open include file: 'libxml/xpath.h': No such file or directory
几个错误,问题的核心是lxml库出现了问题,并且确实libxml2库,在试过多个方案后均不行,最后在将lxml库的版本进行了降级!!!如下:
#> pip install lxml==3.4.4Collecting lxml==3.4.4 Downloading lxml-3.4.4-cp27-none-win32.whl (3.0MB) 100% |################################| 3.0MB 2.9MB/sInstalling collected packages: lxmlSuccessfully installed lxml-3.4.4
这样就成功的安装的Scrapy!!!!!!!!
参考网址:https://bugs.launchpad.net/lxml/+bug/1552818
http://tianxingzhe.blog.51cto.com/3390077/1726574
http://blog.csdn.net/xibeichengf/article/details/50479151