I have installed pyenv in my Mac to manage different python versions.
Before, I have the system default python 2.7 which is located in /Library/Frameworks/Python.framework/Versions/2.7/
and I also have python3 which is located in /usr/local/bin/python3
Now, I installed the pyenv and python 2.7.14 which is located in /Users/hao/.pyenv/shims/python2
I just curious when I want to install some library using 'pip' command, how to make sure I install the library into the right python? For example, I want to use 'pip' to install the torch or tensorflow into pyenv python 2.7.14. But don't want to install them into system default python. Also, how to change the pip3 version?
Here I using the which pip
and which pip3
, the results are:
haos-mbp:~ hao$ which pip
/Users/hao/.pyenv/shims/pip
haos-mbp:~ hao$ which pip3
/usr/local/bin/pip3
/Users/hao/.pyenv/shims/python2 -m pip install
– Lollipoppipenv
which is really awesome. You can simply do apipenv install package-name
and it will add that package to that environment only. – Grantham