Programming/Python

Python : PyCharm 프로젝트 만들고, 실행

파란크리스마스 2024. 8. 12. 15:41
728x90

[File] > [New Project...] 메뉴 선택

실행 환경 설정

main.py 소스

# This is a sample Python script.

# Press Shift+F10 to execute it or replace it with your code.
# Press Double Shift to search everywhere for classes, files, tool windows, actions, and settings.


def print_hi(name):
    # Use a breakpoint in the code line below to debug your script.
    print(f'Hi, {name}')  # Press Ctrl+F8 to toggle the breakpoint.


# Press the green button in the gutter to run the script.
if __name__ == '__main__':
    print_hi('PyCharm')

# See PyCharm help at https://www.jetbrains.com/help/pycharm/

실행

상단에 Run 버튼 선택

실행 결과

D:\workspace.python\Example1\venv\Scripts\python.exe D:\workspace.python\Example1\main.py 
Hi, PyCharm