How to run code in Pycharm

£可爱£侵袭症+ 提交于 2020-02-24 01:01:46

问题


If I go to "tools" and select "python console", and enter several lines of code, how do I execute this? If my cursor is at the end of the script, I can just hit enter. But how can I run the code using keyboard shortcuts if the cursor is not at the end? In Spyder this is done using shift+enter, but I can't figure out how to do it here. I've seen places say control+enter, but that doesn't work. Thanks!


回答1:


If you use Win 10, 64Bits. Run your codes using Ctrl + Shift + F10 or simply right click on the workspace and click Run from the options.




回答2:


From Jetbrains' official documentation: PyCharm suggests several ways to run a script opened in the editor:

  • First, you can use the keyboard shortcut ⌃⇧R

  • Second, you can use the context menu command (here Run Solver), invoked by right-clicking the editor background

  • Use the main menu Run | Run, Run | Run 'Solver'
  • Finally, it is possible to run a script from the main toolbar, using the temporary run/debug configuration Solver



回答3:


in mac. you can use fn+shift+f10 and happy coding with python




回答4:


Right click on project name / select New / select Python File

Pycharm needs to know you're running a Python file before option to run is available



来源:https://stackoverflow.com/questions/42846803/how-to-run-code-in-pycharm

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!