Set up a Python virtual environment. It seems that we are working on several projects, so we need various environments in parallel. You can use pyenv-virtualenv to create an isolated virtual environment.
CentOS8
dnf -y install git
dnf -y groupinstall "Development Tools"
dnf -y install readline-devel zlib-devel bzip2-devel sqlite-devel openssl-devel
pyenv
git clone https://github.com/yyuu/pyenv.git ~/.pyenv
echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.bash_profile
echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.bash_profile
echo 'eval "$(pyenv init -)"' >> ~/.bash_profile
source ~/.bash_profile
exec $SHELL -l
pyenv-virtualenv
git clone https://github.com/yyuu/pyenv-virtualenv.git ~/.pyenv/plugins/pyenv-virtualenv
echo 'eval "$(pyenv virtualenv-init -)"' >> ~/.bash_profile
exec $SHELL -l
Mac
$ brew update
$ brew install zlib
sudo installer -pkg /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg -target /
pyenv, pyenv-virtualenv
$ brew install pyenv
$ brew install pyenv-virtualenv
$ echo 'eval "$(pyenv init -)"' >> ~/.bash_profile
$ pyenv install --list
$ pyenv install 3.7.2
An isolated virtual environment is created based on the specified version.
pyenv virtualenv 3.7.2 (Project name)
When you enter the project directory, you will be able to automatically switch to the virtual environment.
echo (Project name) > (Project name)/.python-version
pyenv virtualenv-delete (Project name)