情形1: ValueError: Invalid configuration: - Deprecated option 'domaincontroller': use 'http_authenticator 成功安裝pyspider以後,運行pyspider all以後會有上面的問題; 解決辦法: ...
情形1:
ValueError: Invalid configuration: - Deprecated option 'domaincontroller': use 'http_authenticator
成功安裝pyspider以後,運行pyspider all以後會有上面的問題;
解決辦法:
在pyspider的安裝包中,找到webui文件夾,然後找到webdav.py文件,找到下麵的代碼:'domaincontroller': NeedAuthController(app),
修改成如下:
'http_authenticator':{ 'HTTPAuthenticator':NeedAuthController(app), }
情形2:
涉及async的錯誤提示 SyntaxError: invalid syntax
原因:
Python 3.5中引入了async和await,在在Python 3.7中成為關鍵字。所以要替換一下關鍵字咯。
解決辦法:
- 降低Python的版本,
- 根據提示路徑把文件裡面的async全部換成async_,
- 一共三個文件
- Python\Lib\site-packages\pyspider\run.py
- Python\Lib\site-packages\pyspider\fetcher\tornado_fetcher.py
- Lib\site-packages\pyspider\webui\app.py
- 一共三個文件
但是 !!!註意:只替換名為async 的變數或參數名。不要圖省事選擇“全部替換” 文件tornado_fetcher.py中如果全部替換是17處,便會報錯
from tornado.curl_httpclient import CurlAsyncHTTPClient from tornado.simple_httpclient import SimpleAsyncHTTPClient
還有下麵兩處引用也不要修改!!!這個很重要
情形3:
from werkzeug.wsgi import DispatcherMiddleware
ImportError: cannot import name DispatcherMiddleware
原因:
- 沒有安裝werkzeug
- werkzeug的版本為1.0.0,這個版本中沒有DispatcherMiddleware方法,所以降低版本可以正常啟動了,
解決辦法:
python -m pip install werkzeug==0.16.1 #安裝0.16.1版本`
情形4:(我沒遇到 手動滑稽)
Deprecated option ‘domaincontroller’: use ‘domain_controller’ instead.
原因:
WsgiDAV發佈了版本 pre-release 3.x導致的,所以只要把版本降下來就好了。
解決辦法:
將wsgidav替換為2.4.1
python -m pip install wsgidav==2.4.1
成功截圖:
訪問 localhost:5000如下