访问量:   最后更新时间:--

肖波

博士生导师

硕士生导师

副教授

性别:男

联系方式:xiaobo@bupt.edu.cn

学位:博士学位

在职信息:在职

所在单位:人工智能学院

学历:研究生毕业

所属院系:人工智能学院

办公地点:教三803,教三718

电子邮箱:

其他联系方式

暂无内容

教师博客
当前位置: 中文主页 > 教师博客
学校机房64位Windows中快速安装python和pytorch等软件环境
发布时间:2020-10-08  点击次数:

本节介绍机房的64windows下如何快速安装condapythonnumpysklearnpytorch等。

每次上机请确保进入64windows

如有问题,欢迎随时和我交流:xiaobo@bupt.edu.cn


1, 安装anaconda(安装完成后,pythonnumpysklearn都可用)

1)访问https://mirrors.tuna.tsinghua.edu.cn/anaconda/archive/


(2)点击下载相应安装程序。

选择下载64位安装程序,如:Anaconda3-2019.07-Windows-x86_64.exe


(3)下载完成后,直接双击exe文件安装即可。

    安装时,注意把conda路径放到windowsPATH环境变量中。


(4)安装完成后,运行cmd,进入windows下的命令行窗口。



(5)测试conda是否安装成功。

    在命令行下运行conda activate base即进入base环境,然后运行python,进入python环境:

上述界面表示conda安装成功。Windows开始菜单中也有相关程序:



   6)在windows命令行下conda base环境中或运行pip list查看conda默认已经安装的包。可以发现numpysklearn等都已经安装好。



2.  conda环境中安装pytorch

(1)修改配置文件”.condarc”

先运行:conda config --set show_channel_urls yes 

该命令在windows用户目录下(如C:\Users\administrator\)生成该文件,打开该文件,将如下内容进行替换文件内容:

channels:
  - defaults
show_channel_urls: true
channel_alias: https://mirrors.tuna.tsinghua.edu.cn/anaconda
default_channels:
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/r
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/pro
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/msys2
custom_channels:
  pytorch: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud


(2)运行cmd,进入命令行,运行

conda install pytorch

安装CPU版本的pytorch。安装过程中根据提示,输入相关选择,如yes。

若在自己带GPU的电脑上安装pytorch,请访问pytorch.org,根据说明进行安装。


(3)检查是否可使用python下的pytorch框架。


4)若安装torchvision,则执行:

conda install torchvision -c pytorch

(完)