684

I downloaded pip and ran python setup.py install and everything worked just fine. The very next step in the tutorial is to run pip install <lib you want> but before it even tries to find anything online I get an error "bash: pip: command not found".

This is on Mac OS X. I'm assuming there's some kind of path setting that was not set correctly when I ran setup.py. How can I investigate further? What do I need to check to get a better idea of the exact cause of the problem?

EDIT: I also tried installing Python 2.7 for Mac in the hopes that the friendly install process would do any housekeeping like editing PATH and whatever else needs to happen for everything to work according to the tutorials, but this didn't work. After installing, running 'python' still ran Python 2.6 and PATH was not updated.

8
  • Did the installation of pip report it was successful? Commented Mar 20, 2012 at 2:48
  • Perhaps you need to run the command as root? Commented Mar 20, 2012 at 2:50
  • I am running terminal using sudo, so everything should be run as root. The installed did report success. Commented Mar 20, 2012 at 2:52
  • 101
    It's because the python3 path (\bin) doesn't have "pip" anymore, it has "pip3". Open your terminal and type "pip3 -v" and I'm sure you'll see it's there. Ever since Python 3.5 pip has been included with Python but they renamed it slightly. Hope that helps. Commented Feb 28, 2019 at 0:59
  • 1
    pip 3 work for me. Ex: pip3 install APScheduler Commented Oct 11, 2019 at 2:28

40 Answers 40

1
2
1
  1. Check if Python is Installed: Pip is bundled with Python versions 2.7.9+ and 3.4+. Open a terminal and type python --version or python3 --version to verify Python's installation. If Python is not installed, you must install it first.

  2. python3 -m pip install <library>

Sign up to request clarification or add additional context in comments.

Comments

0

python-pip use obsolete version of pip (9.0) current post pip version is (18.0) after updating pip edit /usr/bin/pip replace this import:

from pip import main

to

from pip._internal import main

this working for pip 18.0 problem is pip change main function name repeat for /usr/bin/pip3 and /usr/bin/pip2

also view /usr/local/lib/[your_python_version]/dist-packages/pip/__main__.py It should be the same as /usr/bin/pip

Comments

0

Do following:

sudo apt update
sudo apt install python3-pip
source ~/.bashrc

This will surely install pip with all its dependencies. PS this is for python 3 if you want for python 2 replace python3 from the second command to python

sudo apt install python-pip

Comments

0

If on Windows and using the Python installer, make sure to check the "Add Python to environment variables" option.

After installation, restart your shell and retry to see if pip exists.

Comments

0

Follow these steps to install and use the pip command in the UBUNTU terminal APP in Windows (">>" stand for UBUNTU prompt):

>>python3 --version 
             Python 3.6.7
>>sudo apt-get install python-setuptools
>>sudo apt-get update
>>sudo apt-get install python3-pip
>>python3 -m pip install pandas

Comments

0

If you want to install pip2 when you already have pip3:

# get the installer script
curl https://bootstrap.pypa.io/pip/2.7/get-pip.py -o get-pip.py

# install pip
python get-pip.py

Comments

0

For Fedora users:

sudo dnf install python3-pip

Other Fedora and Python related tools, read from: Fedora developer

Comments

0

The problem seems that your python version and the library yoıu want to install is not matching versionally. Ex: If Django is Django3 and your python version is 2.7, you may get this error.

After installing is running 'python' still ran Python 2.6 and PATH was not updated
  1. Install latest version of Python
  2. Change your PATH manually as python38 and compare them.
  3. Try to reinstall

I solved this problem as replacing PATH manually with the latest version of Python. As for Windows: ;C:\python38\Scripts

Comments

0

If you have brew installed

brew install python

If you're working in a conda environment

conda install pip -y

Comments

-3

for new users who are yet to activate the venv for aws cli try this out

source venv/scripts/activate

then try to

pip install awscli

Comments

1
2

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.