Saturday, 28 September 2013

Python - PyCharm - PowerShell terminal - run as administrator

Python - PyCharm - PowerShell terminal - run as administrator

In PyCharm I set my terminal to be the Windows PowerShell, but when I try
to use virtualenv in that terminal:
Import-Module virtualenvwrapper
(I have this command in a startup script, but just included the command
alone for simplicity)
I get the following error:
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
So I try to enable script execution (as I did for PowerShell outside of
PyCharm):
Set-ExecutionPolicy RemoteSigned
but get the following error (I avoided this error outside of PyCharm by
running PowerShell as administrator):
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
So what can I do to be able to use virtualenv from the PyCharm terminal?
Windows 7
Python 2.7
PyCharm Community Edition 3.0

No comments:

Post a Comment