Software and Hardware Environment

  • windows 10 64bit
  • With python 3.7 anaconda
  • Conda 4.8.3

Watch the video here

Here is the YouTube play link, need scientific Internet. If you like my videos, please remember to subscribe to my channel, turn on the little bell next to it, like it and share it, thanks for your support.

preface

The basic installation and use of Anaconda was covered in the previous article, but on Windows, if the terminal tool is using PowerShell, some of conda’s commands are invalid

When the conda Activate DCenter command is used, the DCenter virtual environment is not entered

In CMD, however, Conda functions normally

The solution

Open PowerShell as an administrator and execute commands

conda init powershell
Copy the code

When you close PowerShell and reopen it, an error is reported

This error is caused by PowerShell’s default script execution policy. By executing commands

get-executionpolicy
Copy the code

You can view the current PowerShell execution policy

The default enforcement policy is Restricted, which you can see in the following table

Then you can modify the execution policy. Execute

set-executionpolicy remotesigned
Copy the code

The remotesigned above is the implementation strategy we need to modify, which can be referred to in the following table

Once the new policy is set, let’s check whether it has been set successfully by using get-executionPolicy

Finally, restart PowerShell again and execute conda Activate $virtual environment

Done!

The resources

  • Github.com/conda/conda…
  • Xugaoxiang.com/2019/12/08/…
  • Docs.microsoft.com/zh-cn/power…