【エラー集/Virtualenv】Scriptsactivateができない

背景

Virtualenvで作成した仮想環境(ここではenv1)で\Scripts\activateしようとすると以下のメッセージがでる。

\Scripts\activate : The term '\Scripts\activate' is not recognized as the name of a cmdlet, included, verify that the path is correct and try again.

▼powershellでの実行結果

C:env1>\Scripts\activate \Scripts\activate : The term '\Scripts\activate' is not recognized as the name of a cmdlet, included, verify that the path is correct and try again. At line:1 char:1 + \Scripts\activate + ~~~~~~~~~~~~~~~~~ + CategoryInfo : ObjectNotFound: (\Scripts\activate:String) [], CommandNotFound Exception + FullyQualifiedErrorId : CommandNotFoundException

環境

  • Windows10 version
  • Python3.9.5
  • Virtualenv=20.4.4

結論

Set-ExecutionPolicy Unrestricted -Scope Processを実行する

C:env1> Set-ExecutionPolicy Unrestricted -Scope Process

補足

MicrosoftのQ&Aによると実行時のポリシー設定に問題がある可能性がある。それを修正するためのコマンドが上記。