安裝pyspider出現的問題
本文來自微信公眾號:coder_xiaobu,歡迎關注
一.安裝pyspider
pip install pyspider
二.啟動
pyspider all
三.安裝中出現的問題處理
- 安裝的時候出現如下的錯誤
"Please specify --curl-dir=/path/to/built/libcurl"
解決方法:下載安裝pycurl,下載地址//www.lfd.uci.edu/~gohlke/pythonlibs/#pycurl,下載對應版本的whl文件,比如pycurl‑7.43.0.4‑cp38‑cp38‑win32.whl,然後安裝下載文件,然後再安裝就可以了。
pip3 install pycurl‑7.43.0.4‑cp38‑cp38‑win32.whl
- 啟動的時候出現如下錯誤
async=True, get_object=False, no_input=False):
解決方法:打開python安裝目錄下面的\Lib\site-packages\pyspider\run.py文件,查找所有的async將其替換為async1。
- 啟動出現如下錯誤
def __init__(self, inqueue, outqueue, poolsize=100, proxy=None, async=True):
解決方法:打開python安裝目錄下面的\Lib\site-packages\pyspider\fetcher\tornado_fetcher.py文件,查找所有的async將其替換為async1。
- webUI打不開
解決方法:打開python安裝目錄下面的\Lib\site-packages\pyspider\webui\app.py文件,查找所有的async將其替換為async1。
- 啟動出現如下錯誤:
- Deprecated option 'domaincontroller': use 'http_authenticator.domain_controller' instead
解決方法:打開python安裝目錄下面的\Lib\site-packages\pyspider\webui\webdav.py文件,查找 ‘domaincontroller’: NeedAuthController(app),將其修改為
'http_authenticator':{
'HTTPAuthenticator':NeedAuthController(app),
},
- 啟動出現如下錯誤:
ImportError: cannot import name 'DispatcherMiddleware' from 'werkzeug.wsgi' (D:\soft\python3.8\Lib\site-packages\werkzeug\wsgi.py)
解決方法:降低wsgidav的版本
# 卸載原版本
pip uninstall wsgidav
# 安裝低版本的
pip install werkzeug==0.16.1
- 啟動出現如下錯誤:
pkg_resources.DistributionNotFound: The 'wsgidav>=2.0.0' distribution was not found and is required by pyspider
解決方法,安裝 wsgidav
pip install wsgidav==2.0.0
四、安裝Phantomjs
下載地址://npm.taobao.org/dist/phantomjs/
下載完成配置環境變數,將其下面的bin目錄路徑加入PATH環境變數裡面。