0

I had Python 2.7.6 installed on my system at /usr/bin/python2.7. Now I have downloaded, built, and installed Python 2.7.14 as root. The location was different: /usr/local/bin/python2.7.

I changed to /usr/bin/python symlink to the later one. But now I have all other packages missing like mercurial, cx-oracle, easy_install, pip, etc.

If I try to install those, it says they are already installed which is true as if I revert python symlink to python2.7.6, everything works again.

How do I install all those packages to Python 2.7.14?

$ sudo python -V
Python 2.7.14

$ sudo which python
/usr/local/bin/python

$ python -V
Python 2.7.6

$ which python
/usr/bin/python
StarDust
  • 846
  • 1
  • 13
  • 26
  • Usually /usr/local/bin has only executables and /usr/local/lib has further files required by applications. So I am confused about this change as I would have expected that both python versions have files in both directories. Which Linux distribution and Package manager are you using? – akraf Dec 20 '17 at 00:30
  • @akraf Linux 3.13.0-53-generic #89-Ubuntu SMP Wed May 20 10:34:39 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux – StarDust Dec 20 '17 at 00:44
  • I have no full solution to your problem, only two starts: (1) Are you sure that you called the correct, i.e. the 2.7.14 version of `pip` when attempting to install your packages for 2.7.14? (2) If you have to juggle around with different versions of python at the same time, maybe [virtualenv](https://virtualenv.pypa.io/en/stable/) can help you? – akraf Dec 20 '17 at 00:56
  • `/usr/local/bin/python -m pip install [...]` will do. Make an alias to `/usr/local/bin/python` as necessary. –  Dec 20 '17 at 00:56
  • Do *not* use a symlink: `/usr/bin/python` is relied upon by some of your system tools, and you may break those system tools if you symlink it. –  Dec 20 '17 at 00:56
  • 1
    Your two versions of python might share the same directory where packages are stored (called "site-packages"), as they have the same major and minor version number (2.7) You can find out by [following this SO answer](https://stackoverflow.com/a/46071447/3082472). – akraf Dec 20 '17 at 01:04

0 Answers0