0

It seems like I messed up the system pip by pip3 install --upgrade pip. Actually I even do not exactly remember whether I did upgrade or not.

Now when I try to use pip3, it gives an error like

Traceback (most recent call last):
  File "/Applications/Xcode.app/Contents/Developer/usr/bin/pip3", line 6, in <module>
    from pip._internal import main
ImportError: cannot import name 'main' from 'pip._internal' (unknown location)

I tried sudo python3 -m pip uninstall pip && sudo apt install python3-pip --reinstall to revert back PIP by this answer, but it fails.

/Applications/Xcode.app/Contents/Developer/usr/bin/python3: No module named pip.__main__; 'pip' is a package and cannot be directly executed

which pip3 gives /usr/bin/pip3

Now I am trying to revert back the system tools and use virtual environment. What should I do? I can't even check which pip version is installed at the moment.

Thanks in advance.

hjh5696
  • 53
  • 1
  • 7
  • Not exactly an answer, more like a last resort -- I'd try to install homebrew and install pip via homebrew. – Yuri Khristich Jun 15 '21 at 13:20
  • Have you tried [get-pip.py](https://pip.pypa.io/en/stable/installing/#installing-with-get-pip-py) – Amos Baker Jun 16 '21 at 17:24
  • @AmosBaker Now I am using the virtual environment in my projects but the system's pip might still be in problem. Is it what completely reinstalls the system's pip? – hjh5696 Jun 21 '21 at 12:30

0 Answers0