在 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 呢?
- Windows 7的
- 蟒蛇 2.7
- PyCharm 社区版 3.0