News from this site

 Rental advertising space, please contact the webmaster if you need cooperation


+focus
focused

classification  

no classification

tag  

no tag

date  

no datas

超详细的的PyTorch安装教程,成功率高,适合初学者,亲测可用。

posted on 2023-05-07 21:37     read(560)     comment(0)     like(28)     collect(5)


A few words: There are many tutorials on the Internet, the installation methods are various, the operation is complicated, and the success rate is not high. The editor specializes in helping those who don’t know how to install the remote configuration environment on Taobao. This method has been tested and is suitable for most people. If you follow the article completely, you can basically install it successfully.

If you don’t want to bother anymore , you may contact the technical customer service 3447362049 for remote installation , open Todesk (the customer service will send) the remote software, and you don’t need to prepare anything.


Step 1: Download and install Anaconda

Anaconda, it is recommended to use the same version as that of Weizhiqi Studio, otherwise there may be unavailable download sources or other unknown problems.

download link:

Alibaba cloud disk download address (recommended): https://www.aliyundrive.com/s/MrrK3zZ3j2Z

Baidu network disk download address: link: https://pan.baidu.com/s/1HF2DI0-PgYys1yvV8DfGVQ 

Extract code: 8888

If the above two links are invalid, you can search and download in Xiaoqiang Software Store (zbsc.zjitgzs.cn).


1. After downloading, double-click to run the decompression. Then double-click to run the Anaconda3 installer 

 2、Next

3、I Agree

4. Check Just Me, Next

 5、可以修改为其他盘,例如D盘Anaconda文件夹(路径尽量不要含有中文)

6、一定要记得勾选这两个复选框,否则后续需要手动配置PATH环境变量

 7、当Next按钮变亮,可点击的时候,说明Anaconda已经安装成功,关闭窗口。

第二步:修改Anaconda下载源

1、在电脑左下角开始菜单,打开Anaconda Prompt (anaconda)命令窗口,

2、输入下方命令,创建.condarc文件

conda config --set show_channel_urls yes

3、输入命令回车后,会在C:\Users\wzq(wzq是你的用户名,可以是administrators或者其他的)目录,生成一个.condarc文件

4、右键以记事本方式打开.condarc文件,把里面的内容,全部替换为下方的内容,保存退出。

  1. channels:
  2. - defaults
  3. show_channel_urls: true
  4. default_channels:
  5. - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
  6. - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/r
  7. - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/msys2
  8. custom_channels:
  9. conda-forge: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
  10. msys2: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
  11. bioconda: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
  12. menpo: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
  13. pytorch: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
  14. pytorch-lts: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
  15. simpleitk: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud

此时,anaconda的下载源就已经修改为清华源了

第三步:查看CUDA版本

pytorch安装的CUDA版本,不能高于电脑的CUDA版本,所以在安装前,我们需要知道电脑的版本,有以下几种查看方式。

1.1:在电脑右下角,展开,右键选择控制面板

1.2:右键桌面空白处,选择显卡控制面板

1.3:如果以上2种方式,你都没有找到英伟达控制面板,就需要查看电脑是否有独立显卡了。

1.3.1右键此电脑图标,选择管理。

1.3.2 查看设备管理器,显示适配器,如果有NVIDIA 字样,则说明是有独立显卡的。

1.3.3此时只需更新显卡驱动即可,更新CUDA驱动,可以下载驱动总裁(驱动总裁在线版本_驱动总裁在线版本下载-系统总裁|系统封装首席执行官),进行驱动更新。

1.3.4下载安装完后,重启电脑,应该就可以显示显卡控制面板了。


打开显卡控制面板后→帮助→组件,就可以查看CUDA了

例如我的是11.4(记住这个版本号)

第四步:创建独立虚拟环境

conda create -n PyTorch python=3.8

第五步:获取pytorch安装指令

pytorch官网:Start Locally | PyTorch

Copy the installation instructions in the red box below to Anaconda for installation (it will continue to be updated later)

My CUDA version is 11.4, and the minimum on the pytorch official website above is 11.6, which obviously does not meet the installation requirements, so I need to choose a lower installation command in the historical version.

Historical version: Previous PyTorch Versions | PyTorch

For example, select version 11.3 (not higher than my computer's 11.4, in line), copy the instructions to the anaconda command window for installation

Then enter y and continue to the next step (no need to download cuda separately)

When this interface (the word done) appears, it proves that we have finished downloading.

Step 6: Verify that the installation is successful

Enter in sequence

python

import torch

print(torch.cuda.is_available())

If the test returns True, congratulations, the installation is successful, give the editor a like!

If the test returns FALSE, it is a pity that the installation is not successful. The reason may be the python version problem, graphics card driver version problem, pytorch incompatibility and other problems, which need to be eliminated one by one.

If you don’t want to bother anymore , you may contact the technical customer service 3447362049 for remote installation , open Todesk (the customer service will send) the remote software, and you don’t need to prepare anything.



Category of website: technical article > Blog

Author:Sweethess

link:http://www.pythonblackhole.com/blog/article/373/7beb8a8d4afcf9fb3eff/

source:python black hole net

Please indicate the source for any form of reprinting. If any infringement is discovered, it will be held legally responsible.

28 0
collect article
collected

Comment content: (supports up to 255 characters)