[英]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 我为anaconda安装了pip作为
conda install -c anaconda pip
But it did not change the pip path, it is still 3.5 sys path. 但它没有改变pip路径,它仍然是3.5 sys路径。
How do I use pip installed in anaconda python dir for python 3.6.9? 如何使用安装在anaconda python目录中的pip for python 3.6.9?
Use python -m pip <operation>
使用
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. 你想使用
python -m <module>
是pip
可能不一定是指你所指的python安装。 Even if you have run activate /some/env
, that still doesn't guarantee that the pip
binary will be the one used. 即使您运行了
activate /some/env
,仍然不能保证pip
二进制文件将是使用的那个。
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
. 例如,
$PATH
环境变量可能附加了python路径而不是prepended,因此pip
可能存在于/usr/local/bin
,它将首先被搜索,从而产生错误的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
但是,你知道你要使用,并通过使用哪一种Python
-m
标志,明确配合该模块通过指定的Python版本python
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.