PyCharm では、端末を Windows PowerShell に設定しましたが、その端末で virtualenv を使用しようとすると、次のようになります。
Import-Module virtualenvwrapper
(このコマンドは起動スクリプトに含まれていますが、簡単にするためにコマンドのみを含めました)
次のエラーが表示されます。
Import-Module : File C:\Users\Sean\Documents\WindowsPowerShell\Modules\virtualenvwrapper\support.psm1 cannot be loaded because the execution of scripts is disabled on this system. Please see "get-help about_signing" for more details.
At line:1 char:14
+ Import-Module <<<< virtualenvwrapper
+ CategoryInfo : NotSpecified: (:) [Import-Module], PSSecurityException
+ FullyQualifiedErrorId : RuntimeException,Microsoft.PowerShell.Commands.ImportModuleCommand
そこで、スクリプトの実行を有効にしようとしました ( PyCharm以外の PowerShell で行ったように):
Set-ExecutionPolicy RemoteSigned
しかし、次のエラーが発生します (PowerShell を管理者として実行することで、PyCharm の外部でこのエラーを回避しました):
Set-ExecutionPolicy : Access to the registry key 'HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\PowerShell\1\ShellIds\Microsoft.PowerShell' is denied.
At line:1 char:20
+ Set-ExecutionPolicy <<<< RemoteSigned
+ CategoryInfo : NotSpecified: (:) [Set-ExecutionPolicy], UnauthorizedAccessException
+ FullyQualifiedErrorId : System.UnauthorizedAccessException,Microsoft.PowerShell.Commands.SetExecutionPolicyCommand
では、PyCharm ターミナルから virtualenv を使用できるようにするにはどうすればよいでしょうか?
- ウィンドウズ7
- パイソン 2.7
- PyCharm コミュニティ エディション 3.0