[Pytorch --- 8] 源码安装apex

一. 安装gcc

作者选的版本是8.3.0

0. 安装Pytorch

ImportError: /usr/lib/x86_64-linux-gnu/libstdc++.so.6: version `CXXABI_1.3.11' not found (required by /media/data1/luokunhao/anaconda3/envs/torch150/lib/python3.7/site-packages/torch/lib/libtorch_python.so)

1. 下载并解压

2. 配置configure

./configure --prefix=/home/luokunhao/gcc-8.3.0 --with-mpfr=/home/luokunhao/mpfr-4.0.2 --with-gmp=/home/luokunhao/gmp-6.1.2 --with-mpc=/home/luokunhao/mpc-1.1.
0 --enable-checking=release --enable-languages=c,c++ --disable-multilib

3. 编译

make

4. 安装

make install 

二. apex安装

1. 下载源码

git clone https://github.com/NVIDIA/apex.git

2. 解压

mv apex-master.zip apex.zip
unzip apex.zip

3. 命令行安装

python setup.py install --cuda_ext --cpp_ext

三. bug记录

1. subprocess.CalledProcessError: Command '['ninja', '-v']' returned non-zero exit status 1.

解决: 在指定的conda环境中修改值

即/home/xxx/anaconda3/envs/xxx/lib/python3.7/site-packages/torch/utils/cpp_extension.py中将['ninja','-v']改成['ninja','--v'] 或者['ninja','--version']

 

你可能感兴趣的:(Pytorch)