0

So I decided to buy myself a Raspberry Pi. (whohoo)

After installing the latest Raspbian I want to update Python
If I run python -V the terminal gives me :Python 2.7.16

If I do this:
sudo apt-get update sudo apt-get install build-essential libpq-dev libssl-dev openssl libffi-dev zlib1g-dev sudo apt-get install python3-pip python3.7-dev

It tells me that I already have installed the latest version.

Now how can I get it to run the latest version.

The thing is I want to install svgwrite. This needs Python 3.6 at least.

1
  • Use python3 to run python programs. The default python version is python2 in Buster. – Dougie May 7 '20 at 16:32
2

The latest version will run with the command python3, which is a symbolic link to the most recently installed version of CPython 3. From the look of the installation commands you used it will be CPython 3.7.

2
  • okay. Thnx. Didn't know that. I do this command sudo pip install svgwrite (from a tutorial) but I don't know how to run the command python3 instead of python – Interactive May 9 '20 at 16:49
  • The pip command is also usually a symlink or a copy of a versioned pip file (e.g. pip2.7, pip3.7, pip3.8, etc.). You should be able to use the explicitly numbered version directly. Alternatively you can invoke it with a specific CPython installation like this: /usr/local/bin/python3.8 -m pip install --upgrade svgwrite – Ben May 13 '20 at 12:05
1

Use python3 as the command to start the Python 3 interpreter. The command python runs the default Python version which is still Python 2.

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.