Linux

Install pyenv on mac, activate

Naranjito 2022. 3. 31. 16:18
  • git clone
$ git clone https://github.com/pyenv/pyenv.git ~/.pyenv

>>>

Cloning into '/home/naranja/.pyenv'...

...

 

set up the environment.

 

  • vi ~/.profile
#Add below

export PYENV_ROOT="$HOME/.pyenv"
export PATH="$PYENV_ROOT/bin:$PATH"
eval "$(pyenv init --path)"

 

  • vi ~/.bashrc
#Add below

export PYENV_ROOT="$HOME/.pyenv"
export PATH="$PYENV_ROOT/bin:$PATH"
eval "$(pyenv init -)"

#If installed the virtualenv
eval "$(pyenv virtualenv-init -)"

 

  • source ~/.bashrc

source means read and executes the following files.

$ source ~/.bashrc

 

Check availability of python version.

  • pyenv install --list
$ pyenv install --list

>>>

Available versions:
  2.1.3
  2.2.3
  2.3.7
  
...

 

Install the python.

$ pyenv install 3.9.7

>>>

Downloading Python-3.9.7.tar.xz...

...

 

  • pyenv versions

Check pyenv environments lists

$ pyenv versions
  system
  3.9.7
  3.9.7/envs/nlp_env

 

  • pyenv activate
$ pyenv activate nlp_env