picandies
Posts: 240
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: 14766
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 .

jahboater
Posts: 5216
Joined: Wed Feb 04, 2015 6:38 pm
Location: 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.
"We are in the beginning of a mass extinction, and all you can talk
about is money and fairy tales of eternal economic growth."
- Greta Thunberg

gordon77
Posts: 4689
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: 240
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: 2903
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.

Heater
Posts: 14766
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: 240
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: 2903
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.

ankith26
Posts: 235
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: 179
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: 235
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

Return to “General discussion”