0

I'm trying to install pip2 on a Linux Mint computer, with pip3 already installed in /.local/lib/python3.6/site-packages. I also have both Python 2.7 and Python 3.7 already installed:

$ python -V
Python 2.7.15+
$ python3 -V
Python 3.6.9

But when I try to install pip2, it gives the following error:

$ python get-pip.py
Could not find platform independent libraries <prefix>
Could not find platform dependent libraries <exec_prefix>
Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>]
ImportError: No module named site

Running the command python3 opens the python shell as normal, but running the command python gives the same error. Neither $PYTHONHOME or $PYTHONPATH have been set. Can someone please explain to me how I can resolve this issue?

Edit: I am not using a virtual env. Running apt-get check python2 does not show any broken dependencies. When I set PYTHONHOME to be /usr, the python3 command still opens the shell, but the python and python2 commands give ImportError: No module named site

CSantiago
  • 15
  • 1
  • 1
  • 5
  • 1
    Seems that something's wrong with your python2 installation. Try to uninstall and re-install it again. – Roy2012 May 20 '20 at 05:46
  • sudo apt purge python 2.7-minimal gives the following warning: ```WARNING: The following essential packages will be removed. This should NOT be done unless you know exactly what you are doing! mintsources mint-common (due to mintsources) gir1.2-xapp-1.0 (due to mintsources) 4 upgraded, 0 newly installed, 71 to remove and 501 not upgraded. Need to get 5,414 kB of archives. After this operation, 721 MB disk space will be freed. You are about to do something potentially harmful. ``` Should I just leave all of the packages that depend on python2? – CSantiago May 20 '20 at 12:44
  • emm. did you try apt-get check python2? – Roy2012 May 20 '20 at 13:02
  • Seems to return normally. There don't appear to be any broken dependencies – CSantiago May 20 '20 at 13:23
  • Have you looked at this post? https://stackoverflow.com/questions/19292957/how-can-i-troubleshoot-python-could-not-find-platform-independent-libraries-pr – Roy2012 May 20 '20 at 13:44
  • Yes. I am not using a virtual env. When I set PYTHONHOME to be /usr, the python3 command still opens the shell, but the python and python2 commands give ImportError: No module named site – CSantiago May 20 '20 at 15:36

0 Answers0