Python 爬虫进阶三之 Scrapy 框架安装配置
初級的爬蟲我們利用 urllib 和 urllib2 庫以及正則表達式就可以完成了,不過還有更加強大的工具,爬蟲框架 Scrapy,這安裝過程也是煞費苦心哪,在此整理如下。
官網(wǎng)
官方安裝文檔
安裝python
安裝 Python 安裝過程我就不多說啦,我的電腦中已經安裝了 Python 2.7.7 版本啦,安裝完之后記得配置環(huán)境變量,比如我的安裝在 D 盤,D:\python2.7.7,就把以下兩個路徑添加到 Path 變量中
D:\python2.7;D:\python2.7\Scripts配置好了之后,在命令行中輸入 python —version,如果沒有提示錯誤,則安裝成功
>python --version Python 2.7.18安裝pip
pip 是用來安裝其他必要包的工具,首先下載 get-pip.py 下載好之后,選中該文件所在路徑,執(zhí)行下面的命令
python get-pip.py執(zhí)行命令后便會安裝好 pip,并且同時,它幫你安裝了 setuptools 安裝完了之后在命令行中執(zhí)行
pip --version安裝pywin32
安裝 pywin32 在 windows 下,必須安裝 pywin32,執(zhí)行
pip install pywin32在 python 命令行下輸入 import win32com 如果沒有提示錯誤,則證明安裝成功
安裝pyOPENSSL
在 Windows 下,是沒有預裝 pyOPENSSL 的,而在 Linux 下是已經安裝好的。 安裝地址:https://launchpad.net/pyopenssl
安裝LXML
lxml 的詳細介紹 ,lxml是一種使用 Python 編寫的庫,可以迅速、靈活地處理 XML 直接執(zhí)行如下命令
pip install lxml就可完成安裝,如果提示 Microsoft Visual C++ 庫沒安裝,則點 Microsoft Visual C++ 庫 下載支持的庫。
安裝scrapy
pip install Scrapy >scrapy c:\python27\lib\site-packages\OpenSSL\crypto.py:14: CryptographyDeprecationWarning: Python 2 is no longer supported by the Python core team. Support for it is now de precated in cryptography, and will be removed in the next release.from cryptography import utils, x509 Scrapy 1.8.0 - no active projectUsage:scrapy <command> [options] [args]Available commands:bench Run quick benchmark testfetch Fetch a URL using the Scrapy downloadergenspider Generate new spider using pre-defined templatesrunspider Run a self-contained spider (without creating a project)settings Get settings valuesshell Interactive scraping consolestartproject Create new projectversion Print Scrapy versionview Open URL in browser, as seen by Scrapy 創(chuàng)作挑戰(zhàn)賽新人創(chuàng)作獎勵來咯,堅持創(chuàng)作打卡瓜分現(xiàn)金大獎總結
以上是生活随笔為你收集整理的Python 爬虫进阶三之 Scrapy 框架安装配置的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 深度学习 | MATLAB卷积神经网络原
- 下一篇: Python爬虫学习二爬虫基础了解