파이썬 가상환경을 위한 설정

2023. 9. 1. 09:01웹/백엔드-python

728x90
반응형

프로젝트를 진행하다 보면 여러 모듈을 사용하는데, 각 모듈은 서로 의존성을 가지고 있어 관리하기가 어렵다.

예를 들어 A프로젝트는 (a(1.1버전),b) 모듈을 사용하는데, B 프로젝트는 (a(1,2버전),b)를 사용한다면 a의 버전이 벌써 다르기 때문에 둘 다 전역적으로 설치하여 사용할 수 없다.

 

각각의 필요한 모듈을 별도의 로컬 환경에 설치하여 사용하게 되는데 이를 가상환경이라고 한다.

node.js의 npm 모듈과 같원리이다.

 

node.js는 npm으로 설치하는데 npm은 자동으로 로컬 환경에 모듈을 설치하지만, python이 사용하는 pip는 글로벌 환경에 설치한다. 이 때문에 별도로 가상환경이라는 개념을 적용하게 된다.

 

초기에는 파이썬는 가상환경을 지원해주지 않아 여러 가지 표준/비표준 라이브러리가 존재했다.

 

파이썬 가상환경 설치

파이썬이 관리하는 표준 라이브러니는 설치가 필요없지만 지원하지 않는 비표준은 설치가 필요하다.

여기서는 miniconda를 설치한다. 아래 홈페이지에 설치방법이 있다.

https://docs.conda.io/projects/miniconda/en/latest/

 

Miniconda — miniconda documentation

These three commands quickly and quietly install the latest 64-bit version of the installer and then clean up after themselves. To install a different version or architecture of Miniconda for Windows, change the name of the .exe installer in the curl comma

docs.conda.io

wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh
bash Miniconda3-latest-Linux-x86_64.sh

# 터미널 창 다시 오픈 후
conda list

checksum 참조 사이트

https://jjeongil.tistory.com/1571

 

Linux : Bash : String 문자열 비교 방법, 예제, 명령어

Bash 스크립트를 작성할 때 종종 두 문자열을 비교하여 동일한지 여부를 확인해야 합니다. 두 문자열의 길이가 같고 문자 시퀀스가 같으면 두 문자열이 동일합니다. Bash의 문자열을 비교하는 방

jjeongil.tistory.com

 

윈도우 우분투환경에서 개발환경 구성하기

터미널 색상 변경 프로그램

https://github.com/Gogh-Co/Gogh#-themes

 

GitHub - Gogh-Co/Gogh: Gogh is a collection of color schemes for various terminal emulators, including Gnome Terminal, Pantheon

Gogh is a collection of color schemes for various terminal emulators, including Gnome Terminal, Pantheon Terminal, Tilix, and XFCE4 Terminal also compatible with iTerm on macOS. - GitHub - Gogh-Co/...

github.com

깃 설치하기

sudo apt update
sudo apt install git

git --version

git config --global user.name [your git name]
git config --global user.email [your git email]

깃 관련 터미널 툴들

TIG

깃 커밋 히스토리를 터미널에서 보여 주는 툴

git log와 동일한 기능이지만 훨씬 보기 쉽게 해준다.

자세한건 tig의 깃허브 페이지에서 확인할 수 있다.

https://github.com/jonas/tig

 

GitHub - jonas/tig: Text-mode interface for git

Text-mode interface for git. Contribute to jonas/tig development by creating an account on GitHub.

github.com

TIG manual번역판

https://ujuc.github.io/2016/02/10/tig-manual/

 

[번역] Tig Manual

Tig 메뉴얼 번역 축약본

ujuc.github.io

sudo apt -y install tig

 

Diff SO Fancy

git diff의 출력 화면을 터미널상에서 더 보기 쉽해 출력해주는 깃 플러그인이다.

git diff의 출력 화면은 보기 어려울 수 있는데 이 플러그인은 수정 사항들이 눈에 더 잘 들어온다.

https://github.com/so-fancy/diff-so-fancy

 

GitHub - so-fancy/diff-so-fancy: Good-lookin' diffs. Actually… nah… The best-lookin' diffs. :tada:

Good-lookin' diffs. Actually… nah… The best-lookin' diffs. :tada: - GitHub - so-fancy/diff-so-fancy: Good-lookin' diffs. Actually… nah… The best-lookin' diffs. :tada:

github.com

sudo apt update
sudo apt install npm
sudo npm -g install diff-so-fancy

커널과 사용자의 유저 스페이스를 이어 주는 인터페이스 역할 프로그램.

 

bash보다 편한 zsh 설치하기

sudo apt install zsh -y

# 디폴트 셸을 bash에서 zsh로 변경
chsh -s `which zsh`

# zsh 경로가 나오면 zsh이 디폴트 셸로 설정된 것.
echo $SHELL

 

반응형

' > 백엔드-python' 카테고리의 다른 글

insert 연습  (0) 2023.09.05
Role과 사용자 만들기 / select 연습  (0) 2023.09.05
sql - 1일차 - 오후  (0) 2023.09.04
sql - 1일차 -오전  (0) 2023.09.04
파이썬 가상환경  (0) 2023.09.03