picandies
Posts: 273
Joined: Wed Nov 26, 2014 5:13 pm

need to upgrade python

Sat Feb 08, 2020 4:59 pm

Running rpi3 with Stretch

It has python 2.7.x installed & python 3.5.3
I don't want to upgrade to buster right now

How do I install python 3.7.3? I need it for compat with another system. What is the correct command??
I still need to keep 2.7.x & 3.5.3 installed.

I tried sudo apt-get install python3 (thought it would upgrade to the latest) , but that did not seem to work

Heater
Posts: 18202
Joined: Tue Jul 17, 2012 3:02 pm

Re: need to upgrade python

Sat Feb 08, 2020 5:13 pm

Typically Debian is conservative about adopting new versions for stability reasons. They like to have things tested and integrated well before adoption. Raspbian is based on Debian so it is similarly behind the times.

Using Stretch of course make you even further behind the times.

If you really can't move to Buster you might have to build your own new Python from it's sources.

If you really need to keep 2.7.x & 3.5.3 working as well you are in a big mess and likely to drive yourself crazy!
Memory in C++ is a leaky abstraction .

User avatar
jahboater
Posts: 7035
Joined: Wed Feb 04, 2015 6:38 pm
Location: Wonderful West Dorset

Re: need to upgrade python

Sat Feb 08, 2020 5:16 pm

Heater wrote:
Sat Feb 08, 2020 5:13 pm
If you really need to keep 2.7.x & 3.5.3 working as well you are in a big mess and likely to drive yourself crazy!
Perhaps investigate why your software is dependent on specific versions - its usually a bad thing.
And Python 2.x is officially end of life.

gordon77
Posts: 5678
Joined: Sun Aug 05, 2012 3:12 pm

Re: need to upgrade python

Sat Feb 08, 2020 6:11 pm

I think you will need to build it

For example (l haven't tried it)

https://github.com/instabot-py/instabot ... spberry-Pi

picandies
Posts: 273
Joined: Wed Nov 26, 2014 5:13 pm

Re: need to upgrade python

Sat Feb 08, 2020 9:51 pm

The pyc files sent out need to work with python 3.7.x ..The source code files are not to be sent.
I will try the link...is building it something bad (you will have to build it)? Unless I'm overlooking something, It's just entering 7 or 8 commands into the rpi, rather than one command, to do the upgrade.

User avatar
scruss
Posts: 4085
Joined: Sat Jun 09, 2012 12:25 pm
Location: Toronto, ON
Contact: Website

Re: need to upgrade python

Sat Feb 08, 2020 10:54 pm

You're only getting pyc files? Hmm.

You could always try uncompyle6 (“uncompyle6 translates Python bytecode back into equivalent Python source code. It accepts bytecodes from Python version 1.0 to version 3.8”):

Code: Select all

sudo apt install python3-pip
sudo pip3 install uncompyle6
… or install python3-venv and build your own Python 3.7 interpreter without disturbing the system one.
‘Remember the Golden Rule of Selling: “Do not resort to violence.”’ — McGlashan.
Pronouns: he/him

Heater
Posts: 18202
Joined: Tue Jul 17, 2012 3:02 pm

Re: need to upgrade python

Sat Feb 08, 2020 11:18 pm

picandies wrote:
Sat Feb 08, 2020 9:51 pm
The pyc files sent out need to work with python 3.7.x ..The source code files are not to be sent.
I will try the link...is building it something bad (you will have to build it)? Unless I'm overlooking something, It's just entering 7 or 8 commands into the rpi, rather than one command, to do the upgrade.
I have no idea if there are any difficulties building Python. I think the 'have' is just an indication that 7 or 8 commands is more work than using the installed Python, i.e. none. And, like building and using almost anything there may well be reasons it fails to build that you might have to figure out.
Memory in C++ is a leaky abstraction .

picandies
Posts: 273
Joined: Wed Nov 26, 2014 5:13 pm

Re: need to upgrade python

Sun Feb 09, 2020 1:18 am

You're only getting pyc files? Hmm.


You are not paying attention...I said we are only sending the pyc files, not the source.

User avatar
scruss
Posts: 4085
Joined: Sat Jun 09, 2012 12:25 pm
Location: Toronto, ON
Contact: Website

Re: need to upgrade python

Sun Feb 09, 2020 2:57 am

picandies wrote:
Sun Feb 09, 2020 1:18 am
You are not paying attention...I said we are only sending the pyc files, not the source.
No need to be obnoxious. I read it as “The source code files are not to be sent [to me].”
If you're just sending pyc files as a protection thing, be aware that uncompyle6 can do a pretty much perfect job of reconstructing the source.
‘Remember the Golden Rule of Selling: “Do not resort to violence.”’ — McGlashan.
Pronouns: he/him

ankith26
Posts: 243
Joined: Mon Mar 25, 2019 11:08 am
Location: /home/pi/pythonprojects/test.py
Contact: Website

Re: need to upgrade python

Thu Feb 13, 2020 12:30 pm

If you want to send a python project, but want to keep its source a secret, best way to do this is to use pyinstaller. This builds the executable from the source. In windows, this would mean that an exe file will be created.
No one can read the original source.
But one drawback is that this will make the app platform specific.
I sat thinking for 5 minutes on what to put here. Finally I put something like this.
Check out my github page @ https://github.com/ankith26

markkuk
Posts: 266
Joined: Thu Mar 22, 2018 1:02 pm
Location: Finland

Re: need to upgrade python

Thu Feb 13, 2020 12:47 pm

ankith26 wrote:
Thu Feb 13, 2020 12:30 pm
No one can read the original source.
Not true, the .exe file can be unpacked and the embedded byte codes decompiled:
https://blog.f-secure.com/how-to-decomp ... on-binary/

ankith26
Posts: 243
Joined: Mon Mar 25, 2019 11:08 am
Location: /home/pi/pythonprojects/test.py
Contact: Website

Re: need to upgrade python

Fri Feb 14, 2020 3:11 am

I will obfuscate my project, encrypt it and then use pyinstaller on top of it.
Ok, there is a chance that a person can read the source but it should take them a lot of time.

And remember, you cannot read the source from any exe. Only exe written with pyinstaller/py2exe can be read by the program.
I sat thinking for 5 minutes on what to put here. Finally I put something like this.
Check out my github page @ https://github.com/ankith26

User avatar
bonzadog
Posts: 272
Joined: Wed Apr 25, 2012 9:40 am
Location: Rietberg/Germany

Re: need to upgrade python

Sun Jan 03, 2021 1:28 pm

3.1.2020

Hello,

Raspbarry pi BUSTER


I downloaded python3.7 compiled it, and it runs correctly.
Python3.5 is also callable.


pi@rpi226:~ $ pip3 install numpy
DEPRECATION: Python 3.5 reached the end of its life on September 13th, 2020. Please upgrade your Python as Python 3.5 is no longer maintained. pip 21.0 will drop support for Python 3.5 in January 2021. pip 21.0 will remove support for this functionality.

However, the "standard" python is still 3.5.
How can I get pip3 to work for 3.7 and ,if needed 3.5.

Can anyone please provide a solution...would setting python3 simply to the python3.7 directory.???

DB

hippy
Posts: 9911
Joined: Fri Sep 09, 2011 10:34 pm
Location: UK

Re: need to upgrade python

Sun Jan 03, 2021 2:53 pm

Python 3.7.3 is the default with a fresh install of Raspberry Pi OS Buster. It seems you have messed something up in installing 3.5, then 3.7 on top of that.

There should be no reason to need 3.5 so the best course might be to start with a fresh install of Raspberry Pi OS.

Return to “General discussion”