平台是:windows10 64位、 python3.5
使用 pip install scrapy
安装Scrapy库会首先安装一大堆的依赖库,然后再安装lxml的时候就报错了:
error: Unable to find vcvarsall.bat
然后谷歌这个问题。。stackoverflow上有很多的相关的问题。但是一个个试了都没有解决我的问题。直到一个人说要安装VS2015,其实python3.5的说明中写的有:
The Windows binaries were built with Microsoft Visual Studio 2015, which is not yet officially released. (It’s currently offered in “Preview” mode, which is akin to a “beta”.) It is our intention to ship Python 3.5 using VS2015, although right now VS2015’s final release date is unclear.
但是感觉自己明明已经装了vs2015呀?然后在stackoverflow上看到:
Make sure C++ Common Tools are is installed in Visual Studio.
当时装vs2015是为了做C#开发,所以就没有装C++相关的组件。好吧,问题找到了,然后就去官网重新下载VS2015!官方下载地址 建议使用iso的离线下载。在线好慢哇!
之后再重新安装lxml,终于不报未找到bat的错误了,但是新的错误出现了。。。。
Could not find function xmlCheckVersion in library libxml2. Is libxml2 installed?
什么鬼?呃,遂想着用whl安装吧!到Unofficial Windows Binaries for Python Extension Packages下载whl文件
结果使用wheel install lxml-3.6.0-cp35-cp35m-win_amd64.whl
文件的时报错
attributeError: ‘WheelError’ object has no attribute ‘message’
呃。然后无奈的去谷歌发现可以直接用pip install lxml-3.6.0-cp35-cp35m-win_amd64.whl
果然成功了!!
然后接下里继续使用pip install scrapy
就顺利安装完成了!