2025-01-09T14:30:26

This commit is contained in:
2025-01-09 14:30:26 +09:00
parent 90d9816ea2
commit a6be4b4c30
18 changed files with 941 additions and 0 deletions

55
doc/01_install.md Normal file
View File

@@ -0,0 +1,55 @@
# Python
```bash
sudo apt install python2 # python2를 설치합니다.
sudo apt install python3 # python3를 설치합니다.
sudo apt install python-is-python2 # /usr/bin/python에 대한 링크를 Python 2.x로 지정합니다.
sudo apt install python-is-python3 # /usr/bin/python에 대한 링크를 Python 3.x로 지정합니다.
```
```bash
python2 --version
python3 --version
```
## PIP
Package Installer for Python
```bash
sudo apt install python3-pip
```
```bash
pip install xxx
pip search xxx
pip list
pip show xxx
pip uninstall xxx
pip freeze > requirements.txt # 의존성 목록을 파일로 저장합니다.
pip install -r requirements.txt # 의존성 목록을 설치합니다.
```
## VENV
가상 실행환경
```bash
sudo apt install python3-venv
```
프로젝트 디렉토리로 이동해서 가상 환경을 생성합니다. 일반적으로 `.venv` 디렉토리를 사용합니다.
```bash
cd project-dir
python -m venv .venv
```
가상 환경을 시작합니다. 프롬프트 앞에 가상환경 이름이 표시됩니다.
```bash
source .venv/bin/activate #또는
. .venv/bin/activate
deactivate # 가상 환경을 종료합니다.
```