Reputation: 67
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
Upvotes: 1
Views: 31683
Reputation: 41
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.
Upvotes: 4
Reputation: 29
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
Upvotes: 0
Reputation: 144
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
Upvotes: 1
Reputation: 391
On Linux, you need to install pip from terminal
sudo apt-get -y install python3-pip
Upvotes: 5
Reputation: 3723
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.
Upvotes: 1
Reputation: 1526
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.
Upvotes: 6