未找到 Ubuntu 命令“pip",但有 18 个类似的命令 [英] Ubuntu Command 'pip' not found, but there are 18 similar ones
问题描述
我正在尝试安装一个工具包,我正在使用 ubuntu 在 WSL 上 - 我昨天下载了 ubuntu.以下是此工具包的安装过程.在windows cmd上它说我有python 3.7.9但在ubuntu上它说我有python 3.8.2
I am trying to install a toolkit, I'm on WSL using ubuntu - I downloaded ubuntu yesterday. Here is what the installation process looks like for this toolkit. On windows cmd it says I have python 3.7.9 but on ubuntu its saying I have python 3.8.2
git clone https://github.com...
cd program
pip install -e .
或:
pip install program
pip install -e .
对我不起作用,我收到此错误:
pip install -e .
is not working for me, I get this error:
user@DESKTOP-REA10BN:~/gym$ pip install -e .
Command 'pip' not found, but there are 18 similar ones.
但是,我检查并安装了 pip,这是我在运行前检查的内容:
however, I checked and I have pip installed, here's what I checked for before running:
user@DESKTOP-REA10BN:~$ cd\
> sudo apt-get install python-pip
cdsudo: command not found
user@DESKTOP-REA10BN:~$ python3 --version
Python 3.8.2
user@DESKTOP-REA10BN:~$ python3-pip --version
python3-pip: command not found
user@DESKTOP-REA10BN:~$ which pip3
/usr/bin/pip3
user@DESKTOP-REA10BN:~$ pip3 -V
pip 20.0.2 from /usr/lib/python3/dist-packages/pip (python 3.8)
我的路径:
/home/user/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/mnt/c/Program Files/WindowsApps/CanonicalGroupLimited.UbuntuonWindows_2004.2020.812.0_x64__79rhkp1fndgsc:/mnt/c/windows/system32:/mnt/c/windows:/mnt/c/windows/System32/Wbem:/mnt/c/windows/System32/WindowsPowerShell/v1.0/:/mnt/c/windows/System32/OpenSSH/:/mnt/c/Program Files (x86)/NVIDIA Corporation/PhysX/Common:/mnt/c/Program Files/NVIDIA Corporation/NVIDIA NvDLISR:/mnt/c/WINDOWS/system32:/mnt/c/WINDOWS:/mnt/c/WINDOWS/System32/Wbem:/mnt/c/WINDOWS/System32/WindowsPowerShell/v1.0/:/mnt/c/WINDOWS/System32/OpenSSH/:/mnt/c/Users/user/AppData/Local/Programs/Python/Python37-32/Scripts/:/mnt/c/Users/user/AppData/Local/Programs/Python/Python37-32/:/mnt/c/Users/user/AppData/Local/Microsoft/WindowsApps:/mnt/c/Users/user/AppData/Local/Programs/Microsoft VS Code/bin:/snap/bin
推荐答案
简短回答:尝试运行 python3 -m pip install -e .
一些解释:
Python 的不同版本并不奇怪.WSL 实际上是一个超轻量级的虚拟机.您的 Windows python 安装完全独立于 WSL python 安装.
The different versions of Python are not surprising. WSL is, effectively, an ultra-lightweight virtual machine. Your Windows python installation is entirely independent of the WSL python installation.
Python 有两个广泛使用的主要版本,Python 2 和 Python 3.命令 python
运行 Python 2 的一些次要版本,而命令 python3
运行一些次要版本Python 3. 下面是我的控制台输出.
Python has two widely used major versions, Python 2 and Python 3. The command python
runs some minor version of Python 2, while the command python3
runs some minor version of Python 3. Below is my console output.
lawruble@Balrog:~/scratch$ python --version
Python 2.7.18
lawruble@Balrog:~/scratch$ python3 --version
Python 3.8.5
Pip 是 Python 安装管理器,与 Python 的主要版本相同.命令 pip
运行 Python 2 版本的 pip,而 pip3
运行 Python 3 版本的 pip.
Pip is the python installation manager, and has the same major versions as Python. The command pip
runs the Python 2 version of pip, while pip3
runs the Python 3 version of pip.
最好使用 python3 -m pip
而不是 pip3
,这有助于确保您使用的 pip 版本与您期望使用的 Python 版本相关联运行.
It's better practice to use python3 -m pip
over pip3
, it helps ensure that you're using the version of pip associated with the version of python you expect to run.
这篇关于未找到 Ubuntu 命令“pip",但有 18 个类似的命令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!