Ubuntu系统安装python3.7 和pytorch

折腾了好久,总算安装上了。

python3.7的安装

参考这边博文

https://blog.csdn.net/qq_25863199/article/details/91125794

然后因为Ubuntu16.04默认安装了python3.5
建立软连接的方式参考

https://www.ucloud.cn/yun/23871.html

pip3安装pytorch

在官网找到适合的版本https://pytorch.org/,复制下面的命令,
在后面加上镜像源-i https://pypi.tuna.tsinghua.edu.cn/simple。
sudo pip3 install torch1.3.1+cpu torchvision0.4.2+cpu -f https://download.pytorch.org/whl/torch_stable.html -i https://pypi.tuna.tsinghua.edu.cn/simple
由于权限原因,一开始加上sudo.

问题

在Ubuntu 16.04.6 LTS上安装python3.7和pip3后出现Command ‘(‘lsb_release’, ‘-a’)’ returned non-zero exit status 1问题解决方法。

参考博客
https://blog.csdn.net/tao_627/article/details/90901563

sudo find / -name 'lsb_release.py'
sudo cp  /usr/share/pyshared/lsb_release.py  /usr/local/python3/lib/python3.7/
(命令的后面的部分因个人电脑而异)
sudo cp -fr /usr/lib/python3/dist-packages/CommandNotFound   /usr/local/python3/lib/python3.7/

切换文件夹

	sudo mv CommandNotFound.cpython-35.pyc CommandNotFound.cpython-37.pyc
	sudo mv __init__.cpython-35.pyc __init__.cpython-37.pyc
	sudo mv util.cpython-35.pyc sudo mv util.cpython-37.pyc
发布了16 篇原创文章 · 获赞 3 · 访问量 1068

猜你喜欢

转载自blog.csdn.net/weixin_42233120/article/details/103656267