'I have python installed but pip isn't working
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
Solution 1:[1]
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.
Solution 2:[2]
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.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Captain Caveman |
| Solution 2 |
