Reputation: 2031
I have always been under the belief that pip
manages packages for one's python2, and pip3
for one's python 3. On a JupyterHub server that I run, I have the habit of installing packages that our team uses as root. Doing sudo -i
and then pip3 install <package-name>
. Sometimes, this makes import <package-name>
work from a python3 notebook in Jupyter. But often not. Then, if I instead do pip
install , the package is accessible from notebooks (python3 ones, all of them) on the server. Why is this?
This is what I have:
~# which python
/anaconda3/bin/python
~# which python3
/anaconda3/bin/python3
~# which pip
/anaconda3/bin/pip
~# which pip3
/anaconda3/bin/pip3
~# which jupyter
/anaconda3/bin/jupyter
Upvotes: 2
Views: 11206
Reputation: 2031
I found the answer to my question here:
pip3 always operates on the Python3 environment only, as pip2 does with Python2. pip operates on whichever environment is appropriate to the context. For example if you are in a Python3 venv, pip will operate on the Python3 environment.
Upvotes: 2