如何在 PyCharm 中创建运行当前文件的运行配置? [英] How to make a Run Configuration that runs current file in PyCharm?

查看:31
本文介绍了如何在 PyCharm 中创建运行当前文件的运行配置?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

现在,每次我启动一个新的 Python 文件时,我都必须在 PyCharm 中进行新的运行配置才能运行它.有没有办法让默认配置只运行您正在查看的任何文件?还是我只需要为每个文件创建一个新配置?

Right now, every time I start a new Python file, I have to make a new run configuration in PyCharm in order to run it. Is there a way to have a default configuration that just runs whatever file you are looking at? Or do I just have to make a new config for each file?

推荐答案

在打开模块的编辑器中直接右键单击或按Ctrl + Shift +F10,见在没有任何先前配置的情况下运行.

Simply right-click or press Ctrl + Shift +F10 inside the editor with the module open, see Run without any previous configuring.

IDE 将为您创建一个临时运行配置,该配置使用 File > Settings > 项目 > Python解释器,见在项目设置中更改 Python 解释器.

The IDE will create a temporary run configuration for you that uses the project set in File > Settings > Project > Python Interpreter, see Changing the Python interpreter in the project settings.

这篇关于如何在 PyCharm 中创建运行当前文件的运行配置?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆