xcode-select --install
brew install openssl readline sqlite3 xz zlib
brew update
brew install pyenv
brew install pyenv-virtualenv
echo 'eval "$(pyenv init --path)"' >> ~/.zprofile
echo 'eval "$(pyenv init -)"' >> ~/.zshrc
echo 'eval "$(pyenv virtualenv-init -)"' >> ~/.zshrc
echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.profile
echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.profile
echo 'eval "$(pyenv init --path)"' >> ~/.profile
echo 'if [ -n "$PS1" -a -n "$BASH_VERSION" ]; then source ~/.bashrc; fi' >> ~/.profile
echo 'eval "$(pyenv init -)"' >> ~/.bashrc
echo 'eval "$(pyenv virtualenv-init -)"' >> ~/.bashrc
You may need to open a new shell after this.
Each of the below pyenv <command>
operations is documented here
# pyenv install <python_version>
pyenv install 3.7.12
# pyenv virtualenv <virtualenv_name> <python_version>
pyenv virtualenv myenv 3.7.12
This creates a .python-version
file that tells pyenv
which executable the python
command should point to.
# To use a virtualenv:
# pyenv local <virtualenv_name>
pyenv local myenv
# To use a python base interpreter:
# pyenv local <python_version>
pyenv local 3.7.12
starship.rs displays useful information about your terminal environment, such as the version of Python that's currently active.
Your prompt line should then look something like this:
tasercake on master [$!] via 🐍 v3.7.12 (myenv) on ☁️ (us-east-1)
❯
there is a spot :)
I use pyenv-virtualenv with 1.2.4 version. the command of create virtualenv is
pyenv virtualenv 3.7.12 myenv
.may be the command is different at different version.