python3.7安装pyspider安装教程_Windows环境下Python3安装Pyspider
執(zhí)行命令:
pip3 install pyspider
Windows 下可能會出現(xiàn)這樣的錯誤提示:Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-vXo1W3/pycurl
這個是 PyCurl 安裝錯誤,一般會出現(xiàn)在 Windows 下,需要安裝 PyCurl 庫,下載鏈接為:http://www.lfd.uci.edu/~gohlke/pythonlibs/#pycurl,找到對應 Python 版本然后下載相應的 Wheel 文件。
如 Windows 64 位,Python3.6 則下載 pycurl?7.43.0?cp36?cp36m?win_amd64.whl,隨后用 Pip 安裝即可,命令如下:
pip3 install pycurl?7.43.0?cp37?cp37m?win_amd64.whl
這里的pycurl-7.43.0-cp37m-win_amd64.whl是下載下來的文件路徑
執(zhí)行命令驗證:
pyspider all
出現(xiàn)錯誤:SyntaxError: invalid syntax
原因是:python3.7中async是關鍵字
解決辦法:將這個關鍵字替換掉。主要有兩個文件:~\Lib\site-packages\pyspider\run.py 和 ~\Lib\site-packages\pyspider\fetcher\tornado_fetcher.py
在替換是要注意:只替換名為async 的變量或參數(shù)名。不要圖省事選擇“全部替換”
替換保存后再次運行“pyspider all”
這時spider只啟動到“scheduler xmlrpc listening on 127.0.0.1:23333”就停止了
繼續(xù)替換PYTHON_HOME\Lib\site-packages\pyspider\webui\app.py中的async
再次啟動
又報錯:ValueError: Invalid configuration:
-Deprecated option ‘domaincontroller’: use ‘http_authenticator.domain_controller’ instead.
解決辦法:打開PYTHON_HOME\Lib\site-packages\pyspider\webui\webdav.py文件,修改第209行
把 ‘domaincontroller’: NeedAuthController(app)
修改為:
‘http_authenticator’:{
‘HTTPAuthenticator’:NeedAuthController(app),
},
保存文件
再次運行,成功
這是訪問http://localhost:5000就能打開pyspider的圖形界面了
總結
以上是生活随笔為你收集整理的python3.7安装pyspider安装教程_Windows环境下Python3安装Pyspider的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: bat脚本注释多行_cmd批处理常用符号
- 下一篇: java有链表吗_Java数据结构之链表