简体   繁体   中英

Use Anaconda installed pip

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?

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM