How can I run the current file in PyCharm

2019-02-03 01:57发布

How can I run the current file in PyCharm? I would like a single hotkey that will execute the current file (whether normal file, scratch file, or scratch buffer) using the project default python interpreter. I would like to NOT have to create a custom run configuration, but just launch with the default Python configuration. Is such a thing possible?

7条回答
孤傲高冷的网名
2楼-- · 2019-02-03 02:08

Basically, if you just need to run the current .py file in PyCharm. Right-click inside the file, and you can click the "Run file.py" button, and it also tells you the shortcut which on Mac is Control + Shift + R.

查看更多
看我几分像从前
3楼-- · 2019-02-03 02:11

Just right click on the tab of your file and click run "file name" or you can press CTRL+shift+F10

Screenshot

查看更多
Summer. ? 凉城
4楼-- · 2019-02-03 02:16

The key combination you are looking for is Ctrl + Shift + F10. This will run the current script with current being the one displayed in the viewer.

查看更多
够拽才男人
5楼-- · 2019-02-03 02:18

As it turns out, the action I was seeking is "Run context configuration" (or "Debug context configuration" for debugging). The default key binding on Windows is ctrl+shift+f10, as Ev. Kounis pointed out, although you can bind it to any key you like.

These settings can be found under the "Other" section in File->Settings->Keymap. The easiest way to find them is to simply use the search box.

查看更多
够拽才男人
6楼-- · 2019-02-03 02:18

File->Settings->Keymap->Run->Run and see your current keymap

查看更多
不美不萌又怎样
7楼-- · 2019-02-03 02:20

Alt+Shift+F10 and then select the script you want to run.

After that Shift+F10 will run the last script that has been run.

查看更多
登录 后发表回答