问题描述
我一直试图在pycharm中的Windows上运行powershell作为终端,所以我做了以下事情:
I have been attempting to run powershell as my terminal on windows in pycharm, so I did the following:
但是,当我尝试此操作时,它说它无法执行我的脚本,因此出现以下错误:SecurityError
,完全合格ID为:UnAuthorizedAccess
.
However, when I try this, it says that it cannot execute my scripts, and hence I get the following error: SecurityError
and the Fully Qualified Id is : UnAuthorizedAccess
.
这是因为pycharm的终端无法执行我的Powershell_profile.ps1
配置文件.
This arises from the fact that pycharm's terminal cannot execute my Powershell_profile.ps1
profile file.
如何使用Powershell成功运行Pycharm的终端?
How can I successfully run Pycharm's terminal with Powershell?
到目前为止,我尝试过的工作是进入%windir%/system32/WindowsPowerShell/1.0/profile.ps1
中的主powershell目录,然后将其更改为包括以下内容:
What I have tried so far, is going into my main powershell directory as in %windir%/system32/WindowsPowerShell/1.0/profile.ps1
, and then change it to include the following:
Set-ExecutionPolicy Unrestricted
但是,这无济于事,当我尝试打开pycharm的终端时出现相同的错误.
However, this does not help, and I get the same error when I try to open of pycharm's terminal.
我也尝试过以Admin身份运行pycharm,但这也不能解决问题,并且出现了 same 上面提到的错误.
I have also tried to run pycharm as Admin, however this does not solve the problem either, and I get the same aforementioned error.
推荐答案
我已经以更简单的方式将cmd.exe替换为powershell.exe,希望它能对您有所帮助.我正在使用webstorm2017和Win10操作系统.
I've replaced cmd.exe with powershell.exe in a simpler way and hope it can help.I'm using webstorm2017 and Win10 os.
1.找到powershell.exe
的确切位置.在我看来,我相信大多数计算机中的位置都是C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe
.将整个路径复制到剪贴板中.
1.Find the exact location of powershell.exe
.In mine and I believe in most computers the location would be C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe
.Copy the whole path into your clipboard.
2.在IDE中,打开File => Setting => Tools => Terminal,然后将该路径粘贴到"Shell path"空白中.
2.In your IDE open File=>Setting=>Tools=>Terminal, and paste the path into "Shell path" blank.
3.重新启动IDE,一切正常.
3.Restart the IDE and everything would be ok.
这篇关于在像PyCharm,PHPStorm或RubyMine这样的IntelliJ IDEA IDE中使用Powershell作为终端的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!