An open source and collaborative framework for extracting the data you need from websites.html
In a fast, simple, yet extensible way.python
scrapy是为了抓取所需的网络数据的一个开源的协做框架。它的工做方式简单快速且可扩展。(原谅我耿直的翻译)web
使用pip安装scrapy网络
pip install scrapy
由于个人电脑同时有Python2.7和Python3.5,因此,个人安装代码:框架
py -2 -m pip install scrapy
安装出错:scrapy
根据提示前往http://aka.ms/vcpython27下载Microsoft Visual C++ Compiler for Python 2.7:ide
安装了Microsoft Visual C++ Compiler for Python 2.7后,重启cmd再安装一次,又出错:ui
虽然没有理解错误是什么意思,但大概看出是lxml库的问题:spa
py -2 -m pip install lxml
报了一样的错误:.net
所以,很明显是lxml库致使安装没法继续进行的。我在网上查找了许多方法来解决上面的报错,都没有找到根本缘由,因而我在它的官网http://lxml.de/installation.html(我猜想这是官网)找到了一些解释。
MS Windows
For MS Windows, recent lxml releases feature community donated binary distributions, although you might still want to take a look at the related FAQ entry. If you fail to build lxml on your MS Windows system from the signed and tested sources that we release, consider using the binary builds from PyPI or the unofficial Windows binaries that Christoph Gohlke generously provides.
很明显这应该是建议我使用非官方的二进制文件来进行安装,因此我就找到了这个网址:http://www.lfd.uci.edu/~gohlke/pythonlibs/#lxml,下载适合Python2.7版本的wheel文件:
【Python Wheel (.whl)文件安装实践】
首先应该安装Python wheel库:
py -2 -m pip install wheel
而后安装下载的lxml-3.7.3-cp27-cp27m-win_amd64.whl文件:
在文件所在的位置按住【shift+鼠标右键】→【在此处打开命令窗口】,这样咱们能够直接进入文件所在的路径输命令,固然也能够用cd来进入文件所在的路径或者使用带路径的文件名。
py -2 -m pip install lxml-3.7.3-cp27-cp27m-win_amd64.whl
安装成功。
lxml安装成功后就再也不是咱们安装scrapy的阻碍了,咱们再次输入命令:
py -2 -m pip install scrapy
最终scrapy安装成功,过程当中没有出现报错的状况。
查看已经安装的Python库:
py -2 -m pip list
参考: