Using Powershell as terminal in IntelliJ IDEA IDEs like PyCharm, PHPStorm or RubyMine(在 PyCharm、PHPStorm 或 RubyMine 等 IntelliJ IDEA IDE 中使用 Powershell 作为终端)
问题描述
我一直在尝试在 pycharm 中将 powershell 作为我的终端在 windows 上运行,所以我做了以下操作:
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?
到目前为止,我已经尝试过进入我的主 powershell 目录,如 %windir%/system32/WindowsPowerShell/1.0/profile.ps1
,然后将其更改为包含以下内容:
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.
我也尝试过以管理员身份运行 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.
推荐答案
我已经用 powershell.exe 以更简单的方式替换了 cmd.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:WindowsSystem32WindowsPowerShellv1.0powershell.exe
.将整个路径复制到剪贴板中.
1.Find the exact location of powershell.exe
.In mine and I believe in most computers the location would be C:WindowsSystem32WindowsPowerShellv1.0powershell.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 作为终端的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!