Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make python3 command run Python 3.6 instead of 3.5?

I just downloaded Python 3.6.1, but when I type python3 -V in the terminal it's still Python 3.5.3. How can I make python3 point to Python 3.6? All versions are in the /usr/bin/ directory.

like image 787
ian-campbell Avatar asked May 02 '17 17:05

ian-campbell


People also ask

How do I point python3 to python3 6?

Better to simply call python3. 6 explicitly in those programs where it matters, and leave the python3 symlink as is. This command will create a link in: /usr/bin/python3 to /usr/bin/python3. 6 .

How use python3 command?

To run Python scripts with the python command, you need to open a command-line and type in the word python , or python3 if you have both versions, followed by the path to your script, just like this: $ python3 hello.py Hello World!

What is the python3 command?

The Python3 command was introduced because the python command pointed to python2. Since then, Python3 has become the default and thus python points to python3 on most but not all systems. So, most developers explicitly use python2 and python3 as to not run into issues on other systems.


1 Answers

do

rm /usr/bin/python3 ln -s /usr/bin/python3.6 /usr/bin/python3 

much better solution:

Damn, Python is used throughout much of Ubuntu for system scripts and software, and software relies on having Python (and the commands to start Python) in a certain spot. do back then.

rm /usr/bin/python3  ln -s /usr/bin/python3.5 /usr/bin/python3  

create alias in ~/.bash_aliases

alias python3='/usr/bin/python3.6'  

Scripts can then start with something like:

#!/usr/bin/env python3  
like image 66
tso Avatar answered Oct 03 '22 10:10

tso