简体   繁体   English

如何为 Shell/Bash 脚本设置 PyCharm

[英]How to setup PyCharm for Shell/Bash scripts

I've been struggling for a long time now to get this running but I just couldn't do it.我已经挣扎了很长时间才能让它运行,但我就是做不到。 I am runnning PyCharm Professional on Win10 and I want to code and run Shell scripts, but I cannot get it to work.我在 Win10 上运行 PyCharm Professional,我想编码和运行 Shell 脚本,但我无法让它工作。 There is this Shell Plugin from Pycharm but there is just not enough documention for me to understand how it has to be setup. Pycharm 有这个 Shell 插件,但没有足够的文档让我了解它必须如何设置。 How do I have to setup PyCharm in order to Run/Debug Shell scripts?我必须如何设置 PyCharm 才能运行/调试 Shell 脚本?

I tried changing the shell used by the Terminal to the WSL Ubuntu shell, which actually worked.我尝试将终端使用的 shell 更改为实际有效的 WSL Ubuntu shell。 Thus I can now manually execute the bash script via the terminal.因此,我现在可以通过终端手动执行 bash 脚本。

I also tried changing the Run/Debug configuration.我还尝试更改运行/调试配置。 changed Run/Debug configuration更改运行/调试配置

as suggesteed, changing the interpreter to bash.exe led to an error message.正如所建议的,将解释器更改为 bash.exe 会导致错误消息。 interpreter changed to bash.exe解释器更改为 bash.exe

I tried bash.exe, ubuntu.exe and cmd.exe as shells for terminal, all of which threw a file not found error.我尝试将 bash.exe、ubuntu.exe 和 cmd.exe 作为终端的 shell,所有这些都抛出了一个找不到文件的错误。 As before executing it manually with the wsl path format(/mnt/c/..) works.和之前一样,使用 wsl 路径格式 (/mnt/c/..) 手动执行它是有效的。 manual execution手动执行

"file not found"-error “找不到文件”-错误

So I guess it was my misunderstanding in the end, that you can't really work with shell scripts like you do with python.所以我想最后是我的误解,你不能像使用 python 那样使用 shell 脚本。 meaning debugging etc and watching variables.意味着调试等和观察变量。 I am trying to reduce my file shuffling code in bash anyways and try to stay mainly in python so there is now another motivation for that.无论如何,我试图减少我在 bash 中的文件改组代码,并尝试主要留在 python 中,所以现在有另一个动机。 thank you very much for helping me though.非常感谢你帮助我。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM