報(bào)錯(cuò)內(nèi)容
Traceback (most recent call last):
File "/Library/anaconda3/bin/pyspider", line 6, in
from pyspider.run import main
File "/Library/anaconda3/lib/python3.7/site-packages/pyspider/run.py", line 231
async=True, get_object=False, no_input=False):
^
SyntaxError: invalid syntax
原因是async和await從 python3.7 開始已經(jīng)加入保留關(guān)鍵字中. 參考: What’s New In Python 3.7, 所以async不能作為函數(shù)的參數(shù)名.
改正:
1.修改/Library/anaconda3/lib/python3.7/site-packages/pyspider路徑下的python文件中的async為shark(全部替換)
1.run.py
2.fetcher\tornado_fetcher.py
3.webui\app.py
使用替換命令(注意路徑)
sed -i '' 's/async/shark/g' run.py
sed -i '' 's/async/shark/g' tornado_fetcher.py
sed -i '' 's/async/shark/g' app.py
2.降低WsgiDAV版本
python -m pip install wsgidav==2.4.1
再運(yùn)行
pyspider all
依然報(bào)錯(cuò)
Error: Could not create web server listening on port 25555
[I 190621 11:14:50 result_worker:49] result_worker starting...
Error: Could not create web server listening on port 25555
[I 190621 11:14:51 processor:211] processor starting...
[I 190621 11:14:51 tornado_fetcher:638] fetcher starting...
[I 190621 11:14:51 scheduler:647] scheduler starting...
[I 190621 11:14:51 scheduler:782] scheduler.xmlrpc listening on 127.0.0.1:23333
[I 190621 11:14:51 scheduler:586] in 5m: new:0,success:0,retry:0,failed:0
[I 190621 11:14:51 app:76] webui running on 0.0.0.0:5000
Error: Could not create web server listening on port 25555
Error: Could not create web server listening on port 25555
Error: Could not create web server listening on port 25555
Error: Could not create web server listening on port 25555
解決方法:
Reboot the PC,or remove phantomjs can fix it
查看端口,然后
kill phantomjs
再運(yùn)行pyspider all 成功
這時(shí)pyspider的Web服務(wù)就會(huì)在本地5000端口運(yùn)行。直接在瀏覽器中打開http://localhost:5000/,即可進(jìn)入pyspider的WebUI管理頁(yè)面,這證明pyspider已經(jīng)安裝成功了。
更多文章、技術(shù)交流、商務(wù)合作、聯(lián)系博主
微信掃碼或搜索:z360901061

微信掃一掃加我為好友
QQ號(hào)聯(lián)系: 360901061
您的支持是博主寫作最大的動(dòng)力,如果您喜歡我的文章,感覺我的文章對(duì)您有幫助,請(qǐng)用微信掃描下面二維碼支持博主2元、5元、10元、20元等您想捐的金額吧,狠狠點(diǎn)擊下面給點(diǎn)支持吧,站長(zhǎng)非常感激您!手機(jī)微信長(zhǎng)按不能支付解決辦法:請(qǐng)將微信支付二維碼保存到相冊(cè),切換到微信,然后點(diǎn)擊微信右上角掃一掃功能,選擇支付二維碼完成支付。
【本文對(duì)您有幫助就好】元
