Article directory
- Question: Why should I install Anaconda again?
- Answer: I have reinstalled the system ... and the previous article did not solve the problem of adapting to the new version, so I am here to fill in the gaps.
- This article is suitable for novices (new computers) to install Anconda to avoid various complicated operations.
If you encounter errors or have a soft spot for various complicated operations, please refer to the previous article.
1. Installation
1. Download
Official website
- Click Download to download
- Download ends
2. Installation
Double-click the .exe to install . If the safe installation appears as shown in the picture , just click it.
Windows systems can set up multiple accounts, and each account system has different permissions. When installing the software, select "Just Me" to install it only for yourself. This means that only the account currently logged in will see the software in your own account system. When logging in with other accounts, you will not see the software. . "All Users" is installed for all users (administrator rights are required), which means that when any account logs in to the system, this software can be seen and used.
Select "Just Me" here.
It is installed on the C drive by default. It is recommended to change to other drives. Remember the installation location. It will be used for n reinstallations in the future.
PS: Don’t think this is a vicious curse. You must know that life is incomplete without going through n reinstallations. It is
recommended to select all (check the second item, Not recommended, otherwise you need to set the environment variables by yourself).
The command line is recommended here, so there is no need to check the startup item.
2. Operation
3. Set environment variables
- The meaning of setting environment variables: command line operation
- Those who follow the above steps will skip setting environment variables.
- If you have completed the installation and have not checked the second item, you can refer to the previous article and will not go into details here.
- The end result is:
4. Start terminal operation
a.Initialization
- Open Anaconda Powershell Prompt
- enter
conda init
b. Error: Unable to load file D:\Users\xxx\Documents\WindowsPowerShell\profile.ps1
. : 无法加载文件 D:\Users\Lenovo\Documents\WindowsPowerShell\profile.ps1,因为在此系统上禁止运行脚本。有关详细信息,请
参阅 https:/go.microsoft.com/fwlink/?LinkID=135170 中的 about_Execution_Policies。
所在位置 行:1 字符: 3
+ . 'D:\Users\Lenovo\Documents\WindowsPowerShell\profile.ps1'
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : SecurityError: (:) [],PSSecurityException
+ FullyQualifiedErrorId : UnauthorizedAccess
Don’t panic when a normal terminal becomes abnormal
, Fabao:
- terminal administrator
- enter:
get-ExecutionPolicy
- Output:
Restricted
Indicates that the script execution policy is restricted
- enter:
set-ExecutionPolicy RemoteSigned
Modify the execution policy to RemoteSigned
, indicating that the current user's execution policy takes precedence over the execution policy set for the local computer
- Pay attention. Now the newly opened terminal does not report an error and the word base appears on the left side.
- The above operations must be performed as an administrator, otherwise:
5. Source replacement operation
a. View conda configuration
conda config --show
b. Add mirror source
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
- Set channel address to display when searching
conda config --set show_channel_urls yes
c.Tsinghuayuan _
c. .condarc file
The conda configuration file .condarc
is an optional runtime configuration file that allows users to configure various aspects of conda. This article only introduces the channel-related parts.
.condarc
Open the file using Notepad
channels:
- defaults
show_channel_urls: true
default_channels:
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/r
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/msys2
custom_channels:
conda-forge: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
msys2: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
bioconda: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
menpo: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
pytorch: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
pytorch-lts: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
simpleitk: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
deepmodeling: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/
- Modify
.condarc
files
- Directly set default_channels to Tsinghua source, the effect is consistent with the previous article
- The difference is that the foreign default sources have been completely deleted. The before and after comparison is as shown in the figure.
- The difference is that the foreign default sources have been completely deleted. The before and after comparison is as shown in the figure.
6. Create a virtual environment
- Create environment
conda create -n DL python==3.11
- activate environment
conda activate DL
- Install the deep learning PyTorch package (gpu version)
- Note: The version matching issues involved (different gpu driver versions and python corresponding to different versions of PyTorch) are not within the scope of this article.
conda install pytorch torchvision torchaudio pytorch-cuda=12.1 -c pytorch -c nvidia
- As shown in the figure , download
defaults
fromdefaults
pytorch
nvidia