Table of contents
1. Normal execution and result of the command
PowerShell in Windows currently does not display the virtual environment of conda (as shown in Figure 1). To solve this problem, you can execute the following command.
图1
PowerShell window not showing conda environment
conda init powershell
After the above command is executed, there will be a prompt to restart PowerShell to make the settings take effect (as shown in Figure 2). At this time, close PowerShell and reopen it, and the base environment of conda will be activated by default (as shown in Figure 3).
图2
图3
The PowerShell window of conda's base is displayed by default
2. Instruction execution exceptions and solutions
Problem 1: CommandNotFoundError: No command 'conda conda'
Cause of the problem: The conda version is too high, just lower the conda version.
Solution: You can use the following code to downgrade the version of conda
conda install ---name base conda==指定低版本号(例如:4.6.7)
Question 2: After conda init powershell is executed, restart PowerShell and an error message appears: the file cannot be loaded
Cause of the problem: Windows 10 prohibits powershell from executing any script files by default.
Solution: Just change the execution policy of the script file.
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned
References
[1] Solve the problem that win10 powershell cannot use the conda virtual environment