mac m1 python3.8环境启动pyspider解决的一些问题

我的机器是macOs 13.0.1

1.解决关键字的问题

这个解决方案网站的比较多,主要是async关键字

2.修改utils.py

def run_in_subprocess(func, *args, **kwargs):
    """Run function in subprocess, return a Process object"""
    from multiprocessing_on_dill import Process
    thread = Process(target=func, args=args, kwargs=kwargs)
    thread.daemon = True
    thread.start()
    return thread

修改完成后需要安装:

pip install multiprocessing_on_dill

3. pycurl报错

File "/Users/xxx/opt/anaconda3/envs/py38/lib/python3.8/site-packages/tornado/curl_httpclient.py", line 24, in 
    import pycurl  # type: ignore
ImportError: pycurl: libcurl link-time ssl backends (secure-transport, openssl) do not include compile-time ssl backend (none/other)

修改方式:

pip uninstall pycurl
brew reinstall openssl

修改openssl的环境变量(这个在安装openssl的时候也会有提示):

export CPPFLAGS=-I/usr/local/brew/openssl/include
export LDFLAGS=-L/usr/local/brew/openssl/lib # may be needed

pip install --no-cache-dir --compile --ignore-installed --install-option="--with-openssl" pycurl

4. wsgidav版本过高

File "/Users/xxx/opt/anaconda3/envs/py38/lib/python3.8/site-packages/pyspider/webui/webdav.py", line 207, in 
    '/': ScriptProvider(app)
TypeError: Can't instantiate abstract class ScriptProvider with abstract methods get_resource_inst

修改方式:

pip uninstall wsgidav
pip install wsgidav==2.4.1

5. werkzeug 版本太高

File "/Users/xxx/opt/anaconda3/envs/py38/lib/python3.8/site-packages/pyspider/webui/app.py", line 64, in run
    from werkzeug.wsgi import DispatcherMiddleware
ImportError: cannot import name 'DispatcherMiddleware' from 'werkzeug.wsgi' (/Users/huangcancan/opt/anaconda3/envs/py38/lib/python3.8/site-packages/werkzeug/wsgi.py)

修改方式:

pip uninstall werkzeug
pip install werkzeug==0.16.1
 

6. Flask版本过高

将 Flask 升级到 1.1.4 并将标记安全降级到 2.0.1
pip uninstall Flask
pip install Flask==1.1.4
pip uninstall markupsafe
pip install markupsafe==2.0.1

避免和werkzeug的版本陷入死循环

7. 隔空投送的5000端口占用

这个就需要在“通用”里面,把隔空播放接收器关掉了

8.启动

 

mac m1 python3.8环境启动pyspider解决的一些问题_第1张图片

你可能感兴趣的:(macos,python,开发语言)