프로그래밍
파이썬(Python) 개발 환경 구성 - Poetry
테크토크
2024. 4. 25. 02:52
반응형
파이썬 개발 환경 구성
Poetry
- Poetry : dependency management and packaging in Python
requires
- Python 3.8+
지원 OS
- Linux, macOS, Windows 지원
윈도우 설치 방법
- Poetry 설치
- WSL 사용하는 경우
curl -sSL https://install.python-poetry.org | python3 -
- Powershell 사용하는 경우
(Invoke-WebRequest -Uri https://install.python-poetry.org -UseBasicParsing).Content | py -
- WSL 사용하는 경우
- Poetry 환경 변수 등록
- 시스템 속성 > 환경 변수 >시스템 변수 > 아래 path 추가
%APPDATA%\Python\Scripts
- `APPDATA`가 정의되어 있지 않다면 아래 Path 추가
C:\Users\사용자_윈도우_계정\AppData\Roaming\Python\Scripts\Python\Scripts
- 시스템 속성 > 환경 변수 >시스템 변수 > 아래 path 추가
- 설치 확인
- 버전 확인
>poetry --version Poetry (version 1.8.2)
- 버전 확인
- 업데이트
- self update
>poetry self update Updating Poetry version ... Using version ^1.8.2 for poetry Updating dependencies Resolving dependencies... (7.9s) No dependencies to install or update Writing lock file
- self update
- 실습
- 실습할 폴더 생성 후 초기 세팅 진행
mkdir test cd test poetry init
- 초기 세팅 내용
>poetry init This command will guide you through creating your pyproject.toml config. Package name [2404_langchain]: Version [0.1.0]: Description []: Author [frontmulti <frontmulti@gmail.com>, n to skip]: License []: Compatible Python versions [^3.8]: Would you like to define your main dependencies interactively? (yes/no) [yes] no Would you like to define your development dependencies interactively? (yes/no) [yes] no Generated file [tool.poetry] name = "2404-langchain" version = "0.1.0" description = "" authors = ["frontmulti <frontmulti@gmail.com>"] readme = "README.md" [tool.poetry.dependencies] python = "^3.8" [build-system] requires = ["poetry-core"] build-backend = "poetry.core.masonry.api" Do you confirm generation? (yes/no) [yes]
- 생성 파일 확인
- `pyproject.toml`
[tool.poetry] name = "2404-langchain" version = "0.1.0" description = "" authors = ["frontmulti <frontmulti@gmail.com>"] readme = "README.md" [tool.poetry.dependencies] python = "^3.8" [build-system] requires = ["poetry-core"] build-backend = "poetry.core.masonry.api"
- 실습할 폴더 생성 후 초기 세팅 진행
반응형