0

I have a issue where if a python 3 script's shebang line is /usr/bin/env python3 then script will be interpreted with /usr/bin/local/python3

type -P python3
/usr/local/bin/python3

So PATH python3 is /usr/local/bin/python3 but this creates problems where some packages are not available for /usr/local/bin/python3 and I would instead like to use /usr/bin/python3 as default env python3.

Using a alias to set python3 to /usr/bin/python3 can be done but this does not solve the issue. Using Virtualenv if fine but one can not create a virtualenv for every single litte script out there.

type -a shows that there are two python3 defined on my system so there must be a way to change the prefered one:

type -a python3
python3 is aliased to `/usr/bin/python3'
python3 is /usr/local/bin/python3
python3 is /usr/bin/python3

How can I change so that env python 3 is /usr/bin/python3?

Best regards

S4M11R
  • 399
  • 2
  • 5
  • 14
  • Start using virtual environment to avoid dependency issues [How to use virtualenv](https://stackoverflow.com/questions/35017160/how-to-use-virtualenv-with-python) – Shakeel Sep 19 '18 at 11:28
  • Possible duplicate of [Two versions of python on linux. how to make 2.7 the default](https://stackoverflow.com/questions/19256127/two-versions-of-python-on-linux-how-to-make-2-7-the-default) – Shintlor Sep 19 '18 at 11:48
  • Accepted answer in question: https://stackoverflow.com/questions/19256127/two-versions-of-python-on-linux-how-to-make-2-7-the-default is to use a alias but I have already explained that this is not a solution for me issue. I need to somehow change that /usr/bin/python3 is default env python – S4M11R Sep 19 '18 at 12:36

1 Answers1

0

I solved the issue by editing /etc/environment. The change that I did was to specify to read /usr/bin before /usr/local/bin as was configured on my computer. After that I restarted my PC and now /usr/bin/python3 is the default env python.

S4M11R
  • 399
  • 2
  • 5
  • 14