在PyCharm中,运行脚本后它会自动杀死它:
C:\ Users\Sean.virtualenvs\Stanley\Scripts\python.exe C:/Users/Sean/PycharmProjects/Stanley/Stanley.py
进程以退出代码0结束
如何在脚本启动后与脚本进行交互?由于没有更好的方式来表达它,我怎么能得到它
>>>
脚本运行一次后提示?
在PyCharm中,我将终端设置为Windows PowerShell,但是当我尝试在该终端中使用virtualenv时:
Import-Module virtualenvwrapper
Run Code Online (Sandbox Code Playgroud)
(我在启动脚本中有这个命令,但为了简单起见,仅包含命令)
我收到以下错误:
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
Run Code Online (Sandbox Code Playgroud)
所以我尝试启用脚本执行(就像我在 PyCharm 之外为PowerShell做的那样):
Set-ExecutionPolicy RemoteSigned
Run Code Online (Sandbox Code Playgroud)
但是得到以下错误(我通过以管理员身份运行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 …Run Code Online (Sandbox Code Playgroud)