0

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

3
  • 1
    Don't mess with the version python points to. Important tools on your system might expect it to be Python 2. Worst case would be a hard to repair broken system. If you need python to point to version 3, use a virtual environment. Commented Nov 12, 2018 at 22:04
  • If you copy the error message will be easier to find someone who can help you. Commented Nov 12, 2018 at 22:05
  • How are you installing it? You can do it via pip (it’s on PyPA). Just use pip3 or python3 -m pip install. Commented Nov 12, 2018 at 22:20

4 Answers 4

2

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.

Sign up to request clarification or add additional context in comments.

Comments

0

python3 file.py

Or add #!/usr/bin/python3 to the first line of your code to automatically run it with python 3.

Comments

0

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

Comments

0
  1. List all the installed versions of Python 3: ls /usr/bin/python3*

  2. 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

  3. 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.

  1. Double check, that the change was successfully introduced by: python -V

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.