服务器连不了外网,不能直接conda pip,摸索了很久,终于配置好了。
整体思路就是去PyPI · The Python Package Index找自己需要的库,下载whl文件,上传到服务器上pip install xxx.whl就行了,这里可能会遇到WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProxyError('Cannot connect to proxy.',NewConnectionError('<pip._vendor.urllib3.connection.
HTTPSConnection object at 0x7fdecaba69d0>: Failed to establish a new connection: [Errno -2] Name or service not known'))': /simple/werkzeug/的报错,这是因为缺少了依赖项,提示什么就再去PyPI下载什么,比如这句报错就是缺少了werkzeug这个库。要注意选择正确的版本号,我的python版本是3.9的,每次要找cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl的后缀名文件。
这个地方要注意有时候因为文件名命名不规范,可能会报is not a supported wheel on this platform的错,用pip debug --verbose命令查看当前平台下的规范命名,修改whl文件即可。