Reputation: 3263
I have
python --version
Python 3.6.9 :: Anaconda, Inc.
but
pip3 --version
pip 19.2.2 from /home/ss/.local/lib/python3.5/site-packages/pip (python 3.5)
pip --version
pip 19.2.2 from /home/ss/.local/lib/python3.5/site-packages/pip (python 3.5)
I installed pip for anaconda as
conda install -c anaconda pip
But it did not change the pip path, it is still 3.5 sys path.
How do I use pip installed in anaconda python dir for python 3.6.9?
Upvotes: 1
Views: 137
Reputation: 13106
Use python -m pip <operation>
The reason you want to use python -m <module>
is that pip
might not necessarily refer to the python installation you are referring to. Even if you have run activate /some/env
, that still doesn't guarantee that the pip
binary will be the one used.
For instance, the $PATH
environment variable might have the python paths appended rather than prepended, so pip
might live in /usr/local/bin
which will be searched first, giving the wrong pip
.
However, you know which python you want to use, and by using the -m
flag, you explicitly tie that module to the python version specified by python
Upvotes: 3