Reputation: 15
I would like to install graph tool on ubuntu. Therefore I want to make the default version of python to 3.7 instead of 2.7 because my compiler give me the error, that the python interpreter is to old to run the configure.
So do u know an solution?
Thanks a lot
Upvotes: 0
Views: 4679
Reputation: 483
List all the installed versions of Python 3: ls /usr/bin/python3*
Add Python 3.7 to the alternatives list and change its priority: sudo update-alternatives --install /usr/bin/python python /usr/bin/python3.7 1
Change the default version of Python by using following command:
sudo update-alternatives --config python
Type the number of the version you wish to set as default and confirm with enter.
python -V
Upvotes: 0
Reputation: 57
I'll recommend not using aliases nor changing defaults. Those things have a way of coming back to bite you later on.
By your description, you said that the tool said the interpreter was too old. I'll guess that it needs a python3 interpreter. So what you should do is a simple sudo apt install python3
and use python3
instead of python
when running the code from the terminal.
Example:
Instead of python manage.py runserver
Do... python3 manage.py runserver
Upvotes: 0
Reputation: 11
python3 file.py
Or add #!/usr/bin/python3
to the first line of your code to automatically run it with python 3.
Upvotes: 0
Reputation: 1714
If you need to execute Python3
when you run the python
command, the easiest way to do it is create an alias like this:
alias python=python3
But you don't need to mess with it, maybe you can launch the configurations and run programs with python3
command instead of python
.
Upvotes: 2