0

As explained in title.

Things I've already tried out that didn't work:

  • pip install --upgrade pip
  • brew postinstall python@3.7
  • wget https://bootstrap.pypa.io/get-pip.py, followed by sudo python3.7 get-pip.py (the second command doesn't work)

Consulted articles: How to install PIP on Python 3.6?, more

so far, I've been running whatever I've pip installed in a file that contains python packages by running python [filename.py], rather than python3. So it works fine right now but I want to use python3, since python 2.7 is deprecated anyway

klee
  • 217
  • 1
  • 4
  • 11
  • 1
    Sometimes `pip` gets locked to a version of python. On my system, for example, `pip` installs for `2.7` and `pip3` for `3.7`. If you've installed python3.x.x then you have `pip3` and you can use that to install packages. Similarly you can use `python3` to run your scripts. Better not to override the system's `pip` because it can break things like `apt` on linux – adamkgray Aug 24 '20 at 03:20
  • Try `python3 -m ensurepip` and then use `pip3 install ...`. – Selcuk Aug 24 '20 at 03:26
  • `python3 -m pip install --upgrade pip` – Boris Verkhovskiy Aug 24 '20 at 03:27
  • 2
    Does this answer your question? [How to override the pip command to Python3.x instead of Python2.7?](https://stackoverflow.com/questions/38938205/how-to-override-the-pip-command-to-python3-x-instead-of-python2-7) – lenz Aug 24 '20 at 03:32
  • 1
    https://stackoverflow.com/questions/38938205/how-to-override-the-pip-command-to-python3-x-instead-of-python2-7/38938246 – lenz Aug 24 '20 at 03:32
  • @lenz This answers the question, thanks. Can you write a comment so that I can mark your answer as correct? – klee Aug 27 '20 at 08:38
  • 1
    sudo pip uninstall pip, followed by sudo python3 -m pip install --upgrade --force pip, followed by sudo pip -V for checking – klee Aug 27 '20 at 08:39

4 Answers4

2

You could try using pip3 as that works for python3

Jay Aware
  • 21
  • 1
  • 4
1

I think you are on macOS. In macOS, the commands python and pip refers to Python 2 and pip 2, because Apple uses Python 2. To use Python 3 and pip 3, use the commands python3 and pip3.

pip3 install <yourModule>
Safwan Samsudeen
  • 1,645
  • 1
  • 10
  • 25
-1

try installing by python3 -m pip install <package>

Edited this was a workaround though.

for installing the correct pip, you have to remove prev installations.

for that try ``which pip```

try sudo apt purge pip or sudo apt purge python-pip

also run double-check sudo apt purge pip3 or sudo apt purge python3-pip

Now try which pip and which pip3 make sure none of them are installed

now sudo apt install python3-pip

Sayan Dey
  • 771
  • 6
  • 13
-3

try:

sudo apt install python3-pip

and use

pip3

to call pip

Shawn
  • 45
  • 2
  • 6
    They posted that they tried using `brew postinstall python@3.7` so they are on a Mac. `apt install` won't help. – adamkgray Aug 24 '20 at 03:23