[英]No module named pip after installing pip
I'm trying to download gzip and pip was outdated.我正在尝试下载 gzip 并且 pip 已过时。 I type the following:
我输入以下内容:
C:\Users\username>py get-pip.py
And then I checked if the pip was updated:然后我检查了 pip 是否已更新:
C:\Users\username>pip --version
pip 22.2.1 from C:\Users\username\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\pip (python 3.8)
But when I tried again to pip install, I got the following error message:但是当我再次尝试安装 pip 时,我收到以下错误消息:
C:\Users\username>py -m pip install "gzip"
C:\ProgramData\Anaconda3\python.exe: No module named pip
I think I have two versions of Python and I don't know if I should delete one or not (3.8 and 3.6.1).我想我有两个版本的 Python,我不知道是否应该删除一个(3.8 和 3.6.1)。
C:\Users\username>py --version
Python 3.6.1 :: Anaconda 4.4.0 (64-bit)
Any help is appreciated任何帮助表示赞赏
First of all, gzip
is part of the standard library.首先,
gzip
是标准库的一部分。 Doesn't need installed.不需要安装。
py
command on your PATH is coming from Anaconda. PATH 上的
py
命令来自 Anaconda。 You should be able to use conda install
, then instead.然后,您应该可以使用
conda install
。
You have two different installations of Python on your system.您的系统上有两个不同的 Python 安装。 The one from the App Store (Python 3.8, which has
pip
), and the one from Anaconda (Python 3.6) which does not.来自 App Store 的一个(Python 3.8,它有
pip
),另一个来自 Anaconda(Python 3.6),它没有。
Ideally, you should keep/upgrade Anaconda, as it is more feature-rich, depending on your needs, and uninstall the other.理想情况下,您应该保留/升级 Anaconda,因为它功能更丰富,具体取决于您的需要,然后卸载另一个。
This means pip is not installed on the python environment you are trying to access.这意味着 pip 未安装在您尝试访问的 python 环境中。 So in order to access a specific version of python you can try something like this:
因此,为了访问 python 的特定版本,您可以尝试以下操作:
Python 3.6.1 Python 3.6.1
python3.6 -m pip --version
Python 3.8 Python 3.8
python3.8 -m pip --version
This should allow you to access a specific version of python and see which instance pip is being installed to.这应该允许您访问特定版本的 python 并查看正在安装哪个实例 pip。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.