[英]pip3: command not found but python3-pip is already installed
I can't use pip3 though python3-pip has already been installed.尽管已经安装了 python3-pip,但我无法使用 pip3。 How to solve the problem?
如何解决问题?
sudo pip3 install virtualenv
sudo: pip3: command not found
sudo apt-get install python3-pip
Reading package lists... Done
Building dependency tree
Reading state information... Done
python3-pip is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 11 not upgraded.
You can use python3 -m pip
as a synonym for pip3
.您可以使用
python3 -m pip
作为pip3
的同义词。 That has saved me a couple of times.这救了我几次。
I had a similar issue.我有一个类似的问题。 In my case, I had to uninstall and then reinstall pip3:
就我而言,我必须卸载然后重新安装 pip3:
sudo apt-get remove python3-pip
sudo apt-get install python3-pip
Run跑
locate pip3
it should give you a list of results like this它应该给你一个这样的结果列表
/<path>/pip3
/<path>/pip3.x
go to /usr/local/bin to make a symbolic link to where your pip3 is located转到 /usr/local/bin 以创建指向 pip3 所在位置的符号链接
ln -s /<path>/pip3.x /usr/local/bin/pip3
Same issue on Fedora 23
. Fedora 23
上的相同问题。 I had to reinstall python3-pip
to generate the proper pip3
folders in /usr/bin/
.我不得不重新安装
python3-pip
以在/usr/bin/
生成正确的pip3
文件夹。
sudo dnf reinstall python3-pip
You can make symbolic link to you pip3:你可以给你 pip3 建立符号链接:
sudo ln -s $(which pip3) /usr/bin/pip3
It helps me in RHEL 7.6它在 RHEL 7.6 中对我有帮助
For Kali, you must use this code after the update.对于 Kali,您必须在更新后使用此代码。
$sudo python3 get-pip.py
or if you write this, it also works but not supported anymore.或者如果你写这个,它也可以工作,但不再受支持。 So don't use:
所以不要使用:
$sudo python get-pip.py
Probably pip3
is installed in /usr/local/bin/
which is not in the PATH of the sudo
(root) user. pip3
可能安装在/usr/local/bin/
,它不在sudo
(root)用户的 PATH 中。 Use this instead改用这个
sudo /usr/local/bin/pip3 install virtualenv
On Windows 10 install Python from Python.org Once installed add these two paths to PATH env variable C:\\Users<your user>\\AppData\\Local\\Programs\\Python\\Python38 C:\\Users<your user>\\AppData\\Local\\Programs\\Python\\Python38\\Scripts在 Windows 10 上从 Python.org 安装 Python 安装后将这两个路径添加到 PATH 环境变量 C:\\Users<your user>\\AppData\\Local\\Programs\\Python\\Python38 C:\\Users<your user>\\AppData\\Local\\程序\\Python\\Python38\\Scripts
Open command prompt and following command should be working python --version pip --version打开命令提示符和以下命令应该可以工作 python --version pip --version
There is no need to install virtualenv.无需安装 virtualenv。 Just create a workfolder and open your editor in it.
只需创建一个工作文件夹并在其中打开您的编辑器。 Assuming you are using vscode,
假设您使用的是 vscode,
$mkdir Directory && cd Directory
$code .
It is the best way to avoid breaking Ubuntu/linux dependencies by messing around with environments.这是避免破坏 Ubuntu/linux 依赖项的最佳方式。 In case anything goes wrong, you can always delete that folder and begin afresh.
如果出现任何问题,您可以随时删除该文件夹并重新开始。 Otherwise, messing up with the ubuntu/linux python environments could mess up system apps/OS (including the terminal).
否则,弄乱 ubuntu/linux python 环境可能会弄乱系统应用程序/操作系统(包括终端)。 Then you can press shift+P and type python:select interpreter.
然后你可以按 shift+P 并输入 python:select interpreter。 Choose any version above 3. After that you can do
选择3以上的任意版本。之后就可以了
$pip3 -v
It will display the pip version.它将显示 pip 版本。 You can then use it for installations as
然后您可以将其用于安装
$pip3 install Library
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.