/usr/bin
system/Library
echo $PATH
command:python
for example, the shell looks through the different directories listed in the PATH in order they’re presented above. When the shell finds that command, it stops and calls it even if there is another version of the same command, with the same name, further down in the list.python3
in bash will call python 3.6, not 3.7.source ~/.bash_profile
. ~/.bash_profile
PythonLocalProject
, then display the version of python called by bash by entering python -V
:.python-version
file which tells pyenv
which version of python to run in that directory.ls -la
shows us that file:pyenv versions
:pyenv init
in bash:open ~/.bash_profile
eval '$(pyenv init -)'
source ~/.bash_profile
echo $PATH
will show that a pyenv shim has been added to the beginnning of the path:/Users/username/.pyenv/shims:
which python
will return:/Users/username/.pyenv/shims/python
.python-version
file and enter:pyenv
.PythonLocalProject
folder with the .python-version
file and run python -V
you will notice that it doesn’t run the global version of python, it runs whichever version was last set with the pyenv local
command.which
command to identify where specific versions of python are located:/Library/Frameworks/Python.framework/
directory. Homebrew installs all packages, including python, in /usr/local/Cellar
, then Homebrew adds a symlink to /usr/local/bin
so that its version of python can be found in the path. Finally, Apple installs python in /usr/bin
. Remember, don’t delete that version./Applications
/Library/Frameworks/Python.framework
/usr/local/bin
/Library/Frameworks/Python.framework
and particular versions are found in /Library/Frameworks/Python.framework/Versions/X.Y
. So for example if you wanted to uninstall only version 3.5 but leave other versions you would enter the following commands in bash:python
and python 2 is called python@2
.python
will still start the Apple installed version of Python or some other version. If that’s the case it’s possible that Homebrew’s Python install has become unlinked. This command will unlink and relink Python in Homebrew:~/miniconda2
, ~/miniconda3
,~/anaconda2
, or ~/anaconda3