Linux/terminal

Install pyenv-virtualenv on mac

Naranjito 2022. 3. 31. 16:31

pyenv-virtualenv is the tool to seperate python environment.

 

  • git clone
$ git clone https://github.com/yyuu/pyenv-virtualenv.git ~/.pyenv/plugins/pyenv-virtualenv

>>>

Cloning into '/home/naranja/.pyenv/plugins/pyenv-virtualenv'...

...

 

set up the environment.

  • vi ~/.bashrc
#Add below

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

 

  • source ~/.bashrc

source means read and executes the following files.

$ source ~/.bashrc

 

Install virtualenv and name it.

#pyenv virtualenv [version] [name]
$ pyenv virtualenv 3.9.7 jupyter-env

>>>

Looking in links: /tmp/tmpttvar64k

...

 

Access into virtualenv.

$ pyenv local jupyter-env

>>>

(jupyter-env) naranja@cpu-server1:~/jupyter$

 

Install app and etc.

For example, install jupyter.

(jupyter-env) naranja@cpu-server1:~/jupyter$ python3 -m pip install jupyter

>>>

...

Downloading jupyter-1.0.0-py2.py3-none-any.whl (2.7 kB)

...

(jupyter-env) naranja@cpu-server1:~/jupyter$ python3 -m pip install pandas numpy scikit-learn  matplotlib

...