Pip linux команда не найдена

Решение проблемы «bash: pip: command not found»

Один из распространенных вопросов, возникающих у новичков в Python, связан с ошибкой «bash: pip: command not found». Эта ошибка обычно возникает при попытке установить библиотеку или модуль с использованием инструмента pip.

Возможная ситуация заключается в том, что pip был успешно установлен с помощью команды python setup.py install , но при попытке выполнить команду pip install возникает указанная выше ошибка.

Причина ошибки

Фактически, причина этой ошибки кроется в переменной среды PATH, которая определяет, в каких директориях операционная система будет искать исполняемые файлы. Если путь к исполняемому файлу pip не включен в переменную PATH, то bash (или ваша командная оболочка) не сможет его найти, и вы получите ошибку «pip: command not found».

Решение проблемы

Для решения этой проблемы нужно добавить путь к исполняемому файлу pip в переменную PATH. Для этого можно использовать следующие команды:

  1. Найдите, где установлен pip. Это можно сделать, например, командой find / -name pip . Эта команда найдет все файлы с именем pip в системе. Вывод этой команды может быть довольно большим, но вам нужно найти что-то похожее на ‘/usr/local/bin/pip’ или ‘/usr/bin/pip’.
  2. Добавьте найденный путь в переменную PATH. Это можно сделать, добавив следующую строку в файл .bashrc или .bash_profile (в зависимости от вашей операционной системы):

После выполнения этих шагов и перезапуска командной оболочки проблема должна быть решена.

Источник

How to Fix “Command ‘pip3’ not found” Error in Linux

PIP is the conventional package manager for Python, which is the standard tool for installing and managing Python packages alongside their dependencies which are not included in the standard Python library.

When using pip, you might encounter the error “pip command not found” on the terminal. Below is an excerpt of the error as captured on the Ubuntu system.

$ pip3 install pandas Command 'pip3' not found, but can be installed with: sudo apt install python3-pip

From the output, you can infer that there’s a high chance that PIP is not installed.

Читайте также:  Процесс установки операционных систем linux

In this article, we look at ways how you can install PIP in Linux to fix the “pip command not found” error.

Install PIP in Linux

The first course of action is to ensure that Python is installed on the system, which you can confirm by running:

$ python3 --version Python 3.9.2 

From the output, we already have Python 3.9 installed.

To install PIP on Debian-based distributions, run the following command:

$ sudo apt install python3-pip -y

The command installs PIP alongside a bunch of other additional packages and dependencies.

Install PIP in Debian-based Systems

For RHEL-based distributions such as Fedora, Rocky, AlmaLinux, and CentOS run the following yum command.

$ sudo yum install python3-pip -y

For Arch Linux distributions, execute the command:

$ sudo pacman -S python-pip -y

Once installed, verify the version of the pip installed as shown.

$ pip3 --version pip 20.3.4 from /usr/lib/python3/dist-packages/pip (python 3.9) 

Additionally, you can verify the location of pip binaries as shown

$ which pip3 /usr/bin/pip3 

From the output, we have installed PIP 20.3.4.

Upgrade PIP in Linux

The other way to fix the “pip command not found” error is to upgrade PIP to the latest version.

$ sudo -H pip3 install --upgrade pip

Upgrade PIP in Linux

From the output, we have upgraded the pip from version 20.3.4 to 23.1.2.

PIP – Install Python Packages

Now you should be able to install and manage Python packages and libraries using Pip without an issue.

For example, you can install Pandas as shown.

Install Python Pandas in Linux

In this article, we have successfully resolved the error “pip command not found”. I hope you found this article informative.

Источник

pip: command not found

I encounter a problem when installing pip for python2.7. I downloaded the file get-pip.py, and install it successfully:

bogon:haha itensb$ python get-pip.py Requirement already up-to-date: pip in /Library/Python/2.7/site-packages Cleaning up. 
-bash: pip: command not found 

4 Answers 4

Use python -m pip . If you want the pip command check out @user3282276’s answer.

Читайте также:  Arch linux нет сети

Sounds like your PATH variable is not set to include the location that pip was installed to. On Macs and other *nix like operating systems when you type a command in the command line, what is actually happening is the shell is trying to find the executable file in a predefined area, called the PATH variable. If you are interested check out this question, https://superuser.com/questions/284342/what-are-path-and-other-environment-variables-and-how-can-i-set-or-use-them.

You are able to see what yours is set to if you do this in your command line

this will give you some file paths separated by colons, for example when I type the command above I get this:

/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/git/bin:/Applications/Android Dev Tool/sdk/tools 

which means that my shell will check for a executable in each of these files, if it finds it, it will run otherwise it will tell you the program can’t be found. As a side note this is the reason why when you run an executable not in one of these PATH files you must do,

this is specifying a relative path to the executable file, the current directory that you are in.

So for you, you installed pip to this directory:

/Library/Python/2.7/site-packages 

chances are the above echo statement did not include this file, if it did then you have another problem. What you need to do is to update your PATH variable to include this directory as well. To do this you add an export statement to your .bash_profile (or .bashrc on Linux) in your home directory (this is a hidden file) that includes your current path variables (so you will still be able to run everything installed in the proper place) and this new directory that you installed pip to. To do this add this line to the end of your .bash_profile

export PATH=$:/Library/Python/2.7/site-packages 

and you should be good to go. However before it will take effect you need to close and open your terminal window again or run source .bash_profile . You can verify this worked by running the echo command above, it should return the same thing but this time with /Library/Python/2.7/site-packages appended to the end.

Читайте также:  Установить драйвер видеокарты линукс минт

Note: By the way the which command that you were told to run in the comments locates a program within the users path, which is why it did not return anything to you. Also since you will probably run into this soon enough there is also a variable called PYTHONPATH (look here) which tells python where to look to import modules. You should set this to whatever directory you have pip installing modules to if it is not already set.

Источник

Ubuntu Command ‘pip’ not found, but there are 18 similar ones [closed]

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.

This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.

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 . 
user@DESKTOP-REA10BN:~/gym$ pip install -e . Command 'pip' not found, but there are 18 similar ones. 
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 

Источник

Оцените статью
Adblock
detector