pyenv-virtualenv is a pyenv plugin that provides features to manage virtualenvs and conda environments for Python on UNIX-like systems.
If you don't have pyenv in your system, follow below post;
Installing pyenv-virtualenv
$ brew update
$ brew install pyenv-virtualenv
Setting PATH
Run one of the following commands in terms of your shell's .rc
file.
$ echo 'eval "$(pyenv virtualenv-init -)"' >> ~/.bashrc
$ echo 'eval "$(pyenv virtualenv-init -)"' >> ~/.zshrc
Creating virtual environment
$ mkdir python_demo
$ cd python_demo
$ pyenv install 3.11.4
$ pyenv virtualenv 3.11.4 python_demo-3.11.4
$ pyenv virtualenvs
$ pyenv prefix python_demo-3.11.4
/Users/kenanhancer/.pyenv/versions/python_demo-3.11.4
$ ls -Llat $(pyenv prefix python_demo-3.11.4)
drwxr-xr-x 14 kenanhancer staff 448 19 Jun 17:36 bin
-rw-r--r-- 1 kenanhancer staff 107 19 Jun 17:36 pyvenv.cfg
drwxr-xr-x 3 kenanhancer staff 96 19 Jun 17:36 lib
drwxr-xr-x 2 kenanhancer staff 64 19 Jun 17:36 include
$ tree -a -L 4 $(pyenv prefix python_demo-3.11.4)
├── bin
│ ├── Activate.ps1
│ ├── activate
│ ├── activate.csh
│ ├── activate.fish
│ ├── pip
│ ├── pip3
│ ├── pip3.11
│ ├── pydoc
│ ├── python -> python3.11
│ ├── python3 -> python3.11
│ └── python3.11 -> /Users/kenanhancer/.pyenv/versions/3.11.4/bin/python3.11
├── include
│ └── python3.11
├── lib
│ └── python3.11
│ └── site-packages
│ ├── _distutils_hack
│ ├── distutils-precedence.pth
│ ├── pip
│ ├── pip-23.1.2.dist-info
│ ├── pkg_resources
│ ├── setuptools
│ └── setuptools-65.5.0.dist-info
└── pyvenv.cfg
Continue reading