WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /whl/cu90/torch/
wget https://www.python.org/ftp/python/3.8.18/Python-3.8.18.tar.xz tar -xvf Python-3.8.18.tar.xz cd Python-3.8.18
编辑 Modules/Setup 文件(很重要),修改如下配置
1 2 3 4 5 6 7 8 9
# Socket module helper for socket(2) _socket socketmodule.c # 取消注释
# Socket module helper for SSL support; you must comment out the other # socket line above, and possibly edit the SSL variable: SSL=/usr/local/ssl # 修改为编译 OpenSSL 时设置的目录 _ssl _ssl.c \ -DUSE_SSL -I$(SSL)/include -I$(SSL)/include/openssl \ -L$(SSL)/lib -lssl -lcrypto
编译 Python
1 2 3
./configure make make install
编译 make 之后,输出信息里面可能出现 _ctypes 模块编译失败,这可能会导致后面引入 PyTorch 时出现错误,所以可以安装 libffi-dev 后,重新编译并安装一次