0

Say I compile Python 3 from source, configuring it with --prefix=$HOME/.local and installing it.

Since $HOME/.local is in my path, and is preferred, now when I type python3 in my shell, I get my Python installation, and not the default installed by Ubuntu. I would prefer this.

Would having this different python3 on the path affect the system in any way? Does the system explicitly refer to /usr/bin/python3?

Furthermore, if I install packages in this new Python, they are accessible from the system Python as well, because Python looks in the $HOME/.local directory. Does this mean I should install my personal Python somewhere else, so any packages installed are not found by the system path?


I am aware of virtualenv, and it is not what I am asking about.

5
  • Depends on how you compile , you should be fine if you install into /usr/local (/opt is for pre-compiled binaries)
    – Panther
    Feb 10, 2018 at 0:38
  • Why would you want the headache of being a Python3 developer unless there is some function you want to change like 2+2 is always 3? Feb 10, 2018 at 1:01
  • @Terrance That isn't my question. That is very much obvious.
    – orlp
    Feb 10, 2018 at 1:08
  • Yes, obviously I'm aware of the fact that "if it reads the one you have first it might affect...", which is the whole point why I'm asking if it actually will affect, rather than 'might'. My question is if the Python the system relies upon uses my personal PATH or not.
    – orlp
    Feb 10, 2018 at 1:15
  • Never mind. Honestly, if it was my system I would just try it and see. That's how we learn
    – Terrance
    Feb 10, 2018 at 1:23

1 Answer 1

0

I take it you're installing packages via pip. Try running pip3 show pip or python3 -m pip show pip. This will show you where the pip package itself is installed This is the same path it puts other packages. To verify, install a harmless package like pycodestyle and check where it got installed using the same process as before.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.