본문 바로가기

내가 당면한 문제와 해결방안

python 환경 관리

virtualenv : 내가 원하는 모듈만 운용하는 바구니 (https://dgkim5360.tistory.com/entry/python-virtualenv-on-linux-ubuntu-and-windows)

 

 

virtualenv만 있나? 

ㄴㄴ

 

뭐가있지?

 

검색.

 

https://www.pluralsight.com/tech-blog/managing-python-environments/

 

Managing Python Environments

If you're not careful, your Python environment can quickly become a disaster. We'll walk through the available tools to be more (code) environmentally friendly and establish some (highly opinionated) preferences for setting up Python.

www.pluralsight.com

왜 좋은가

 

 

  • virtualization is your friend: isolating your Python environment per-project makes your life infinitely easier by avoiding dependency clashes between projects
  • projects should be reproducible: the more tightly you can specify dependencies, the easier it is to exactly reproduce the running environment for your code on the fly, for yourself or another dev
  • self-contained = deployable: the easier it is to pack up and ship an environment with all the trimmings, the easier it is to get projects running on radically different systems (like moving from a dev environment to deployment)

음 맞는말이네 

도커로도 가능한 부분이긴 함

 

 

그래서 뭘 쓰면 미니멀하게 좋을가??

일단 `venv`가 built-in임.

 

virtualenv는 venv  보다 더 원할 때 쓰면 좋다 이게 원조

 

근데 저거 두개는 

 

Both of the above solutions only address package management - in either case, the user is left managing the installed Python version(s) manually.

 

이런 단점ㅇ ㅣ있다. 

말 그대로 설치된 파이썬 버전은 관리를 해줘야한단 것.

 

pyenv 는 homebrew로 설치할수있고(편하다)

파이썬 버전 별로 관리해준단것 근데 이거는 가상환경 (pip . python package 꾸러미 바구니)을 관리해주는건 아니라서, 

 

병행해서 쓰는 것인데

ㅣ것마저도 어떤 개발자들이 해놨다 

 

pyenv-virtualenv 를 쓰면 된다하네 ㅋㅋ 

 

pyenv virtualenv $PYTHON_VERSION $VENV_NAME

 

이렇게 쓴다구.. 

단점이있다면 이건 윈도우즈에서는 사용이 어렵겠다. 

 

다른ㄷ거 더 있는거같은데 

 

읽기가 싫다.

영어는 너무 어렵다.

 

 

 

엉망으로 관리되던 다른 프로젝트의 패키지들을

도커 이미지 안에 넣으려고 하다가 . (나도모르게)

아 이건 넣을 필요없지

 

하고 검색하다 정리하는 글. 

 

 

autoenv 까지만 설정하믄 될듯 (http://guswnsxodlf.github.io/pyenv-virtualenv-autoenv)

 

 

poetry 참고.

'내가 당면한 문제와 해결방안' 카테고리의 다른 글

logstash postgres to elasticsearch  (0) 2020.05.15
logstash postgres to elasticsearch  (3) 2020.04.21
postgres ilike  (0) 2020.04.02
elastiesearch doc upsert  (0) 2020.02.25
postgres 트리거 만들기  (0) 2020.02.25