加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > 安全 > 正文

如何在PyCharm运行配置中运行shell脚本而不是python?

发布时间:2020-12-15 18:49:40 所属栏目:安全 来源:网络整理
导读:我试图设置PyCharm来调用一个 shell脚本,而不是 python,作为运行选项.这可能吗?在默认选项中,我只有 Python,Python文档和Python测试.与专业版我也有Django和其他人.但是,它们都在python作为解释器在组合框中,它们不能被改变,我可以看到. 如果您想在PyCharm
我试图设置PyCharm来调用一个 shell脚本,而不是 python,作为运行选项.这可能吗?在默认选项中,我只有 Python,Python文档和Python测试.与专业版我也有Django和其他人.但是,它们都在python作为解释器在组合框中,它们不能被改变,我可以看到.
如果您想在PyCharm中看到这样的功能,请投票支持 IDEA-112256
‘Command Line’ Run Configuration功能要求.

Pycharm在线帮助的Run/Debug Configurations部分列出了所有支持的运行/调试配置类型,并且不支持shell脚本.
但是,您可以通过安装插件来添加此类支持.例如,如果您对bash脚本感兴趣,则会在运行/调试配置中添加支持运行shell脚本的BashSupport插件.

从插件的主页:

BashSupports can directly run scripts within IntelliJ. You can create
a new run configuration for Bash scripts. Here you can set which
interpreter is used to run it. Whenever a script is executed the
output is logged. If Bash prints out syntax errors then the errorneous
lines are clickable to jump to the location of the error.

对于Windows,有CmdSupport插件提供了运行.cmd脚本的操作.它似乎不支持运行这样的脚本,如运行/调试配置.

作为一种解决方法,您可以使用Python运行/调试配置,指定一些虚拟(空)Python文件运行,并使用“启动前”选项指定外部工具,并在添加/配置此外部工具时指定脚本路径.详见In IntelliJ IDEA,how can I create a key binding that executes a shell script with the current file as a parameter?.

由于PyCharm是基于IntelliJ的IDEA平台,所以问题IntelliJ IDEA: Running a shell script as a Run/Debug Configuration是非常相关的.

说到运行/调试配置,你可能对插件Run Configuration as Action感兴趣

(…) provides a way to use run configurations as buttons on toolbar. Or assign shortcuts to execute specific run configuration.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读