## πŸ›  사전 μ€€λΉ„ ### ν•„μˆ˜ μ„€μΉ˜ ν•­λͺ© 1. **Python 3.12.3** 2. **pyenv** (Python 버전 관리) 3. **Poetry** (μ˜μ‘΄μ„± 관리) ### μ„€μΉ˜ 방법 #### πŸͺŸ Windows ```powershell # 1. pyenv-win μ„€μΉ˜ Invoke-WebRequest -UseBasicParsing -Uri "https://raw.githubusercontent.com/pyenv-win/pyenv-win/master/pyenv-win/install-pyenv-win.ps1" -OutFile "./install-pyenv-win.ps1" & "./install-pyenv-win.ps1" # PowerShell μž¬μ‹œμž‘ ν›„ # 2. Python 3.12.3 μ„€μΉ˜ pyenv install 3.12.3 # 3. Poetry μ„€μΉ˜ (Invoke-WebRequest -Uri https://install.python-poetry.org -UseBasicParsing).Content | python - ``` #### 🍎 Mac/Linux ```bash # 1. pyenv μ„€μΉ˜ curl https://pyenv.run | bash # ν™˜κ²½ λ³€μˆ˜ μ„€μ • (zsh κΈ°μ€€) echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.zshrc echo 'command -v pyenv >/dev/null || export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.zshrc echo 'eval "$(pyenv init -)"' >> ~/.zshrc source ~/.zshrc # 2. Python 3.12.3 μ„€μΉ˜ pyenv install 3.12.3 # 3. Poetry μ„€μΉ˜ curl -sSL https://install.python-poetry.org | python3 - ``` --- ## πŸš€ ν™˜κ²½ μ„€μ • ### 1. μ €μž₯μ†Œ 클둠 #### πŸͺŸ Windows ```powershell git clone cd Codeit-AI-1team-LLM-project ``` #### 🍎 Mac/Linux ```bash git clone cd Codeit-AI-1team-LLM-project ``` ### 2. Python 버전 μ„€μ • ν”„λ‘œμ νŠΈ 폴더에 `.python-version` 파일이 있으면 μžλ™μœΌλ‘œ Python 3.12.3을 μ‚¬μš©ν•©λ‹ˆλ‹€. #### πŸͺŸ Windows ```powershell # 확인 python --version # Python 3.12.3이 μ•„λ‹ˆλ©΄: pyenv local 3.12.3 ``` #### 🍎 Mac/Linux ```bash # 확인 python --version # Python 3.12.3이 μ•„λ‹ˆλ©΄: pyenv local 3.12.3 ``` ### 3. Poetry μ„€μ • #### πŸͺŸ Windows ```powershell # κ°€μƒν™˜κ²½μ„ ν”„λ‘œμ νŠΈ 내뢀에 생성 python -m poetry config virtualenvs.in-project true ``` #### 🍎 Mac/Linux ```bash poetry config virtualenvs.in-project true ``` --- ## πŸ“¦ μ˜μ‘΄μ„± μ„€μΉ˜ `poetry.lock` νŒŒμΌμ„ κΈ°μ€€μœΌλ‘œ μ •ν™•νžˆ λ™μΌν•œ λ²„μ „μ˜ νŒ¨ν‚€μ§€λ₯Ό μ„€μΉ˜ν•©λ‹ˆλ‹€. #### πŸͺŸ Windows ```powershell # Python 버전 μ§€μ • python -m poetry env use 3.12.3 # μ˜μ‘΄μ„± μ„€μΉ˜ python -m poetry install # κ°€μƒν™˜κ²½ ν™œμ„±ν™” python -m poetry shell ``` #### 🍎 Mac/Linux ```bash # Python 버전 μ§€μ • poetry env use 3.12.3 # μ˜μ‘΄μ„± μ„€μΉ˜ poetry install # κ°€μƒν™˜κ²½ ν™œμ„±ν™” poetry shell ``` **μ„€μΉ˜ μ™„λ£Œ 확인:** ν”„λ‘¬ν”„νŠΈ μ•žμ— `(.venv)`κ°€ λΆ™μœΌλ©΄ 성곡! βœ… ``` (.venv) PS C:\Codeit-AI-1team-LLM-project> # Windows (codeit-ai-1team-llm-project-py3.12) user@computer:~/project$ # Mac/Linux ``` --- ## 🎯 ν”„λ‘œμ νŠΈ μ‹€ν–‰ ### κΈ°λ³Έ μ‹€ν–‰ #### πŸͺŸ Windows ```powershell # κ°€μƒν™˜κ²½μ΄ ν™œμ„±ν™”λœ μƒνƒœμ—μ„œ python main.py ``` #### 🍎 Mac/Linux ```bash # κ°€μƒν™˜κ²½μ΄ ν™œμ„±ν™”λœ μƒνƒœμ—μ„œ python main.py ``` ### κ°€μƒν™˜κ²½ λ‚˜κ°€κΈ° #### πŸͺŸ Windows & Mac/Linux ```bash exit ``` --- ## πŸ‘₯ 개발 κ°€μ΄λ“œ ### 일상적인 μž‘μ—… 흐름 #### πŸͺŸ Windows ```powershell # 1. ν”„λ‘œμ νŠΈ ν΄λ”λ‘œ 이동 cd C:\Codeit-AI-1team-LLM-project # 2. μ΅œμ‹  μ½”λ“œ λ°›κΈ° git pull # 3. μ˜μ‘΄μ„± μ—…λ°μ΄νŠΈ (νŒ€μ›μ΄ νŒ¨ν‚€μ§€ μΆ”κ°€ν•œ 경우) python -m poetry install # 4. κ°€μƒν™˜κ²½ ν™œμ„±ν™” python -m poetry shell # 5. 개발 μž‘μ—…... # 6. μž‘μ—… μ’…λ£Œ exit ``` #### 🍎 Mac/Linux ```bash # 1. ν”„λ‘œμ νŠΈ ν΄λ”λ‘œ 이동 cd ~/Codeit-AI-1team-LLM-project # 2. μ΅œμ‹  μ½”λ“œ λ°›κΈ° git pull # 3. μ˜μ‘΄μ„± μ—…λ°μ΄νŠΈ (νŒ€μ›μ΄ νŒ¨ν‚€μ§€ μΆ”κ°€ν•œ 경우) poetry install # 4. κ°€μƒν™˜κ²½ ν™œμ„±ν™” poetry shell # 5. 개발 μž‘μ—…... # 6. μž‘μ—… μ’…λ£Œ exit ``` ### μƒˆ νŒ¨ν‚€μ§€ μΆ”κ°€ #### πŸͺŸ Windows ```powershell # νŒ¨ν‚€μ§€ μΆ”κ°€ python -m poetry add # 예: requests μΆ”κ°€ python -m poetry add requests # 개발 도ꡬ μΆ”κ°€ python -m poetry add --group dev pytest # Git 컀밋 git add pyproject.toml poetry.lock git commit -m "Add " git push ``` #### 🍎 Mac/Linux ```bash # νŒ¨ν‚€μ§€ μΆ”κ°€ poetry add # 예: requests μΆ”κ°€ poetry add requests # 개발 도ꡬ μΆ”κ°€ poetry add --group dev pytest # Git 컀밋 git add pyproject.toml poetry.lock git commit -m "Add " git push ``` --- ## πŸ› 문제 ν•΄κ²° ### Python 버전이 3.12.3이 μ•„λ‹ˆμ—μš” #### πŸͺŸ Windows ```powershell pyenv local 3.12.3 python --version ``` #### 🍎 Mac/Linux ```bash pyenv local 3.12.3 python --version ``` ### Poetry λͺ…λ Ήμ–΄λ₯Ό 찾을 수 μ—†μ–΄μš” #### πŸͺŸ Windows ```powershell # Poetryλ₯Ό python λͺ¨λ“ˆλ‘œ μ‹€ν–‰ python -m poetry --version # PATH μΆ”κ°€ (영ꡬ적) [Environment]::SetEnvironmentVariable("Path", [Environment]::GetEnvironmentVariable("Path", "User") + ";$env:APPDATA\Python\Scripts", "User") ``` #### 🍎 Mac/Linux ```bash # PATH μΆ”κ°€ export PATH="$HOME/.local/bin:$PATH" # 영ꡬ 적용 echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.zshrc source ~/.zshrc ``` ### Import μ—λŸ¬κ°€ λ‚˜μš” ```bash # κ°€μƒν™˜κ²½μ΄ ν™œμ„±ν™”λ˜μ–΄ μžˆλŠ”μ§€ 확인 # ν”„λ‘¬ν”„νŠΈμ— (.venv)κ°€ μžˆμ–΄μ•Ό 함 # μ—†λ‹€λ©΄ λ‹€μ‹œ ν™œμ„±ν™” poetry shell # Mac/Linux python -m poetry shell # Windows # μ˜μ‘΄μ„± μž¬μ„€μΉ˜ poetry install # Mac/Linux python -m poetry install # Windows ```