개발린생

[Python] macOS에서 homebrew 명령어를 통해 설치하고 VSCode에서 실행하기 본문

Dev Lab ✧.·˚/etc.

[Python] macOS에서 homebrew 명령어를 통해 설치하고 VSCode에서 실행하기

김블루 2024. 11. 23. 19:25

학교에서 수강하는 파이썬프로그래밍 과목을 수강하며 파이썬 시작 /^0^/

학교 강의는 윈도우 환경에서 작업하지만 나는 맥북을 사용한다.

그러므로 chatGPT의 도움을 받아 파이썬을 설치하고 실행해보겠다.

 


Homebrew를 사용한 Python 설치 명령어

brew install python

나의 경우 위 명령어 실행 후 아래 에러가 발생했다.

==> Deleted Installed Formulae
pkg-config ✘

 

pkg-config ✘는 pkg-config라는 Homebrew 패키지가 삭제되었음을 의미하여 아래 명령어를 통해 패키지 재설치를 진행함

brew install pkg-config

 

 

VSCode 설치

VSCode 설치 링크 : https://code.visualstudio.com/

 

Visual Studio Code - Code Editing. Redefined

Visual Studio Code is a code editor redefined and optimized for building and debugging modern web and cloud applications. Visual Studio Code is free and available on your favorite platform - Linux, macOS, and Windows.

code.visualstudio.com

 

 

VSCode에서 프로젝트 생성

  • 프로젝트 폴더 생성 (ex. mini_game_project)
  • VSCode에서 해당 프로젝트 폴더 열기 (ex. mini_game_project)
  • 왼쪽 파일 탐색기 프로젝트 폴더에 app.py 파일 생성 및 코드 작성
def main():
    print("Hello from VS Code!")

if __name__ == "__main__":
    main()
  • Extensions에서 Python 검색 후 install
  • app.py 파일을 열고 상단 ▶️ RUN 클릭
  • 터미널에 Hello from VS Code! 출력되면 완료!

환경 셋팅은 완료됐으니 과제하러.. 👋