1

when I do python --version or python3 --version in my terminal it gives me python2.7.18 and python3.8.9 accordingly. But when I try and use pip, which should be installed with python, I get "zsh: command not found: pip"

ALSO: I cannot find where my python packages are installed. I've tried to delete them but it isn't working. These are the commands I do to uninstall them:

In my Library folder: sudo rm -rf Python

In root:

sudo rm -rf “/Applications/Python”
sudo rm -rf /Library/Frameworks/Python.framework
sudo rm -rf /usr/local/bin/python

even after doing these commands when I do python --version it tells me I have python

2
  • "But when I try and use pip, which should be installed with python" This is not a correct assumption. Depending on how you installed Python, it might not include pip. Commented Mar 16, 2022 at 17:32
  • "when I do python --version it tells me I have python" Do which python to find where the python executable is located. Commented Mar 16, 2022 at 17:33

7 Answers 7

6

To locate the path to your pip and python installations:

$ which python
/usr/bin/python
$ which python3
/usr/local/bin/python3
$ which pip
/usr/local/bin/pip
$ which pip3
/usr/local/bin/pip3

If the which command doesn't find pip, you need to install it.

python3 install pip

Also, if you have multiple Python projects, it is a good idea to create virtual environments for each of them. This will isolate the modules you install to each project environment.

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

2 Comments

thanks this helped, looks like I don't have pip but I have pip3 so the pip install requests worked when I used pip3
pip3 worked for me
5

On Linux, you need to install pip from terminal

sudo apt-get -y install python3-pip

Comments

5

Use pip3 instead of pip in your command line. I struggled to find a solution for this for ages but this change worked for me.

Comments

1

If you are not installed python, lets 1st install python.

Install python:

brew install python

The most recent releases of Python already include pip, so there's no need to install it separately. If your version of Python doesn't have pip included, you should upgrade to the latest version.

brew update
brew upgrade python

Then try your command with "pip"

example:

pip install Scrapy

If the previous doesn't work and, if your python version is Python 3, then try using the "pip3" instead of "pip”

example:

pip3 install Scrapy

Comments

1

pip is a python library. it doesn't have to have pip.

I suggest you use pyenv which will give you the option to create many virtual environments and install pip by default.

github pyenv how to instructions

Often in development one needs to import functionality from libraries outside the canonic python distribution. Different projects need different imports and often different versions of the same library. A virtual environment enables one to curate library versions for specific uses.

2 Comments

I think I'm too new to everything to do this lmao I don't even know what virtual environments are, I downloaded anaconda and it ended up messing up some stuff for me so I had to delete that and python and restart the entire process, thank you though I'd thumbs up if I could
This site has a thorough walk through: realpython.com/python-virtual-environments-a-primer
0

That's how I fixed mine

1 - curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py python3 get-pip.py

2 - nano ~/.zshrc

3 - export PATH="$HOME/.local/bin:$PATH"

4 - source ~/.zshrc

Comments

0

Even I faced the same issue.

Try pip3 install "Your Package" .That should work.

1 Comment

Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.