Skip to content

Instantly share code, notes, and snippets.

@sigmadream
Created December 26, 2022 01:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sigmadream/bdcd44cc172da01bde278ec8ff02ef16 to your computer and use it in GitHub Desktop.
Save sigmadream/bdcd44cc172da01bde278ec8ff02ef16 to your computer and use it in GitHub Desktop.

pyenv

1. pyenv 설치

  • github에서 pyenv를 설치
$ git clone https://github.com/pyenv/pyenv.git ~/.pyenv
Cloning into '/home/sd/.pyenv'...
remote: Enumerating objects: 22430, done.
remote: Counting objects: 100% (5/5), done.
remote: Compressing objects: 100% (5/5), done.
remote: Total 22430 (delta 0), reused 1 (delta 0), pack-reused 22425
Receiving objects: 100% (22430/22430), 4.57 MiB | 3.89 MiB/s, done.
Resolving deltas: 100% (15148/15148), done.
  • pyenv 속도를 높이기 위해서 bash에 필요한 몇가지 설정을 컴파일
$ cd ~/.pyenv && src/configure && make -C src
make: Entering directory '/home/sd/.pyenv/src'
gcc -fPIC     -c -o realpath.o realpath.c
gcc -shared -Wl,-soname,../libexec/pyenv-realpath.dylib  -o ../libexec/pyenv-realpath.dylib realpath.o 
make: Leaving directory '/home/sd/.pyenv/src'

2. pyenv 설정

  • zsh에 pyenv 설정
$ 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

3. python 컴파일 환경 구성

$ pyenv install 3.11
$ sudo apt install ...

4. 활용 방법

$ pyenv global 3.11
$ pyenv rehash
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment