#安裝
pip3 install scrapy
successfully installed automat-20.2.0
# 環境變數,別名
vim ~/.bash_profile
#mac上做環境變數和別名
path=
"/library/frameworks/python.framework/versions/3.7/bin:$"
alias scrapy=
"/library/frameworks/python.framework/versions/3.7/bin/scrapy"
#使生效,會出現總是要執行這個才支執行的命名
source ~/.bash_profile
問題別名不如軟鏈來的好
ln -s /library/frameworks/python.framework/versions/3.7/bin/scrapy /usr/local/bin/scrapy
# 使用scrapy
```bash
# 生成專案
scrapy startproject douban
# 生成正則,主邏輯檔案,在:douban/douban/下執行
scrapy genspider douban_spider movie.douban.com
#生成後結構如:
douban/douban/spiders/douban_spider.py
#執行#在這個目錄下:/users/macbook/documents/vscode/python/scrapy/douban/douban
scrapy crawl douban_spider
#在settings.py中填寫user-agent
scrapy專案根路徑
|scrapy檔案:
|spiders
|items.py
|pipelines.py
|....
|main.py
|scrapy.cfg
錯誤main.py檔案中 unknown command: crawl
方案:調整vscode 的目錄結構scrapy的安裝,scrapy建立專案
簡要 scrapy的安裝 1 pip install scrapy i 國內源 一步到位 2 報錯1 building twisted.test.raiser extension error microsoft visual c 14.0 is required.get it with micros...
scrapy(一)scrapy 安裝問題
pip install scrapy 注 若出現以下安裝錯誤 building twisted.test.raiser extension error microsoft visual c 14.0 is required.get it with microsoft visual c build t...
Scrapy 安裝及使用
目前只支援python2 pip install scrapy公升級scrapy pip install upgrade scrapy和scrapy打交道時,你所遵循得最通用的流程是ur im流程。進入你想儲存專案的目錄 scrapy startproject tutorialtutorial sc...