某古老代码 其中源码编译cuda函数,需要Pytorch 1.0以下版本(实测0.4可以,0.4.1就不行gcc报错)和Python 3.6。
首先源码编译安装Python 3.6
- 解压源码后,到其目录下
./configure
make && make install
结果无法使用pip,显示ssl模块未安装。按照网上方法./configure --with-ssl完全不会有效。
- 应该先安装ssl相关库和TK库:
sudo apt-get install openssl
sudo apt-get libssl-dev
sudo apt-get install tcl-dev tk-dev python3-tk
- 改下Moudles/Setup
#修改结果如下:
# Socket module helper for socket(2)
_socket socketmodule.c timemodule.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
_ssl _ssl.c \
-DUSE_SSL -I$(SSL)/include -I$(SSL)/include/openssl \
-L$(SSL)/lib -lssl -lcrypto
- 重新走一波节奏
sudo ./configure
sudo make && make install
- python3.6
>>>import ssl #检测成功!
>>>
安装Pytorch0.4.0(0.4.1也不太行)
cuda_10.0的话可以,10.1就不行