1. Install homebrew
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
2.Install Pyenv
brew install pyenv pyenv-virtualenv
pyenv install -l
3.Test pyenv
pyenv virtualenv 3.12.0 myproject
pyenv local myproject
pyenv virtualenv-delete my project
4.Test python
$ python3 --version
Python 3.9.6
$ which -a python3
/usr/bin/python3
==================================================
FIX Python not found in ZSH
Rus this
brew info python
Python has been installed as
/opt/homebrew/bin/python3
Unversioned symlinks `python`, `python-config`, `pip` etc. pointing to
`python3`, `python3-config`, `pip3` etc., respectively, have been installed into
/opt/homebrew/opt/python@3.11/libexec/bin
Open profile config
nano ~/.bash_profile
I use zsh and VS Code, so I ran this:
code ~/.zshrc
Add the following lines to the file:
export PATH="/opt/homebrew/opt/python@3.11/libexec/bin:$PATH"
Now reload the shell profile by running the following command:
source ~/.bash_profile
For zsh, you could use this:
source ~/.zshrc
Top comments (0)