developer tip

Pycharm : Python 파일의 일부만 실행

optionbox 2020. 11. 13. 08:04
반응형

Pycharm : Python 파일의 일부만 실행


PyCharm에서 프로그램의 일부만 실행할 수 있습니까?

다른 편집기에는 실행할 수있는 셀과 같은 것이 있지만 PyCharm에서 이러한 옵션을 찾을 수 없습니까?

이 함수가 존재하지 않으면 큰 단점이 될 것입니다. 데이터 분석을 위해 코드의 마지막 몇 줄만 실행하면되는 경우가 많기 때문입니다.


더 쉬운 방법을 찾았습니다.

  • 파일-> 설정-> 키맵으로 이동하십시오.
  • Execute Selection in Console과 같은 새 바로 가기를 검색 하고 다시 할당합니다 Crl + Enter.

이것은 Spyder 및 R-Studio의 동일한 작업에 대한 동일한 바로 가기입니다.


콘솔에서 "선택"을 실행하기위한 Pycharm 단축키는 ALT + SHIFT + e입니다.

이것이 제대로 작동하려면 모든 것을 이런 방식으로 실행해야합니다.

여기에 이미지 설명 입력


You can select a code snippet and use right click menu to choose the action "Execute Selection in console".


You can set a breakpoint, and then just open the debug console. So, the first thing you need to turn on your debug console:

여기에 이미지 설명 입력

After you've enabled, set a break-point to where you want it to:

여기에 이미지 설명 입력

After you're done setting the break-point:

여기에 이미지 설명 입력

Once that has been completed:

여기에 이미지 설명 입력


  1. Go to File >> Settings >> Plugins and install the plugin PyCharm cell mode
  2. Go to File >> Settings >> Appearance & Behavior >> Keymap and assign your keyboard shortcuts for Run Cell and Run Cell and go to next

A cell is delimited by ##

Ref https://plugins.jetbrains.com/plugin/7858-pycharm-cell-mode

참고URL : https://stackoverflow.com/questions/23441657/pycharm-run-only-part-of-my-python-file

반응형