栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > Python

深度学习环境配置——Linux下的torch=1.2.0环境配置

Python 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

深度学习环境配置——Linux下的torch=1.2.0环境配置

**

1.下载安装Python-3.6.2

下载Python-3.6.2.tgz软件包**

[root@localhost ~]# mkdir -p /server/tools/
[root@localhost tools]# cd /server/tools/
[root@localhost ~]# wget https://registry.npmmirror.com/-/binary/python/3.6.2/Python-3.6.2.tgz
2 解压编译安装
[root@localhost tools]# tar -xf Python-3.6.2.tgz
[root@ tools]# cd Python-3.6.2
[root@localhost Python-3.6.2]# ./configure
[root@localhost Python-3.6.2]# make
[root@localhost Python-3.6.2]# make install
3.修改默认的python

删除旧的python的软连接,创建新的python2和python3的软连接

[root@localhost Python-3.6.2]# cd /usr/bin/
[root@localhost bin]# rm -f python2
[root@localhost bin]# mv python python2.6.ori
[root@localhost bin]# ln -s python2.6 python2
[root@localhost bin]# ln -s /usr/local/bin/python3 /usr/bin/python
4、检查修改后的python版本
[root@localhost bin]# python -V
Python 3.6.2
[root@localhost bin]# python2 -V
Python 2.6.6
[root@localhost bin]# python3 -V
Python 3.6.2
5.安装pip及setuptools (1)安装setuptools(可以不安装)
[root@bogon ~]# wget --no-check-certificate https://pypi.python.org/packages/source/s/setuptools/setuptools-19.6.tar.gz#md5=c607dd118eae682c44ed146367a17e26
[root@localhost ~]# tar zxvf setuptools-19.6.tar.gz
[root@localhost ~]# cd setuptools-19.6
[root@localhost ~]# python3 setup.py build
[root@localhost ~]# python3 setup.py install
(2)pip安装(必须安装,否则无法运行pip命令)
[root@localhost ~]# wget --no-check-certificate https://pypi.python.org/packages/source/p/pip/pip-8.0.2.tar.gz#md5=3a73c4188f8dbad6a1e6f6d44d117eeb
[root@localhost ~]# tar zvxf pip-8.0.2.tar.gz
[root@localhost ~]# cd pip-8.0.2
[root@localhost pip-8.0.2]# python3 setup.py build
[root@localhost pip-8.0.2]# python3 setup.py install
6、pytorch官方推荐安装方法(推荐)

打开pytorch的官方安装方法:
https://pytorch.org/get-started/previous-versions/
官网推荐的安装代码如下,我使用的是Cuda10的版本,不太懂为什么要写3个=才能正确定位,两个=会定位到cuda92的whl:

# CUDA 10.0
pip install torch===1.2.0 torchvision===0.4.0 -f https://download.pytorch.org/whl/torch_stable.html

7.其他依赖安装
scipy==1.2.1
numpy==1.17.0
matplotlib==3.1.2
opencv_python==4.1.2.30
torch==1.2.0
torchvision==0.4.0
tqdm==4.60.0
Pillow==8.2.0
h5py==2.10.0

创建一个requirements.txt文件,复制上述内容到txt文件中。

pip install -r C:UsersDELLDesktoprequirements.txt

接下来就可以自己跑项目啦!!!!

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/878949.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号