Installing and running Python 3.7


I would like to install the latest Python version (3.7.3), to create a virtual environment with some libraries and run custom code.

This should be possible, my question is will this interfere with any of the Autopi’s processes?
My idea is to isolate it using a virtual environment, so in principle it should not alter any of the already installed Python’s: /usr/bin/python2.7 and /usr/bin/python3.5.

Running Python using the “Custom Code” section of seems to call Python 2.7, but activating the virtual environment with Python 3.7 and running a custom script is possible in principle (I did a quick test). Any foreseen problems?

Many thanks in advance,


Hi iipr

That is really hard to say, but as you already mention, if it does not modify the python directory, then it should be fine.
I can’t say if activating the python37 environment from inside the python 2.7 custom code module, will do anything to the process. If you run some more tests, feel free to keep us in the loop, it sounds really interesting.

If all else fails, then you could always ‘wrap’ it by having it execute your external python 3.7 script from the code module - but that way you need to push your script ‘unmanaged’ to the device via SSH instead.

Best regards

Hi All,

Just ordered 4G/LTE Edition (GEN2) as i could see the immense potential of it and right after was wondering what version of Python come pre-installed on these.This section here was pretty much the only way to find something with regards to what’s pre-installed but have to admit i still feel confused. I just started learning Python and obviously am using the latest at this point(v3.7.4 or so) and on a Windows 10 machine, so what iipr is trying to do there makes me feel a bit lost to say the least… so i guess what i’m asking(with the risk of repeating what iipr’s asked) is what version is it installed? and if it comes with Python 2.xx can Python 3.xx be installed and also keep the API functionality? Apologies for probably asking very basic/core stuff but coming from a different environment where i’ve only tinkered with Arduino/C++ on a Windows machine, i feel this being like a million pieces of a puzzle to put together and so i’m just trying to put them right asap.

Kind Regards,
George M.

1 Like

Hi @GeorgeM987,

I didn’t have a 2nd gen autopi, but I believe that model also encages a Raspberry Pi Zero W.
In that case it should come with python 2.7 and 3.5 (as many unix based systems).
I cannot check right now because I don’t have the autopi with me, but from the command line
you can type python -V, python2 -V or python3 -V to be sure, and which python to
find out about its path in the system.

In principle it should be possible to install python 3.7, but this may (or may not) affect other
autopi processes. You could try and worse case flash the autopi. The point is that depending
on what you want to do probably you won’t feel any difference between 3.5 and 3.7, so maybe
you could avoid installing the latter.

My last point to mention is that if possible, use a virtual environment so that you can freely install
the libraries (and libraries’ versions) that you wish. In this way, your python is encapsulated in an
environment (inside a folder), which is generally cleaner and could avoid problems. Sketch about
how to create a venv:

mkdir ~/py-envs
python3 -m venv ~/py-envs/py-3.5
source ~/py-envs/py-3.5/bin/activate
cd py-envs
python3 ./

If you want to run a python script from the interface, it will call python2 (at least when
I tried), but from there you can activate your python environment and run the script with that python.
So the flow would be: --> python2 --> activate py-3.5 --> run script with py-3.5

There could be a better way to run python3, but this is the way I tried.
Hope it helps.


1 Like

Thanks for reaching out and for further clarifying everything; it does make more sense now…i’ll just have to wait for about 3 weeks or so until i’ll have mine delivered to start tinkering with it; in the meantime i’ll make a slow start in my Python project and hopefully by the end of the week i’ll have delivered my first ever RPI4 and do some tinkering with that as well…at least to try an understand the difference between different OS’s that run Python.

Best Regards,
George M.

Let us know if you get this software working on the RPi4, because I can’t get it to boot on mine. Maybe some small change can be made to the boot section of the SD card? :confused:

Hi @scrampker,

The RPi4 requires the use of the latest Raspbian Buster image. Unfortunately, we dont yet use Buster but only Jessie. Its on our road map to upgrade the AutoPi Core image to the latest revision of Raspbian.


Hi Peter,

Is there a chance to get an update to see if Autopi will work with the newer versions of Raspbian or the RPI4?

Thanks in advanced!!

Hi @Dsandi,

Its is something we are working on actively. But I cannot say when the new image will be ready. I’d recommend that you follow our newsletters and the announcements section: