Active Topics

 


Reply
Thread Tools
Posts: 1,548 | Thanked: 7,510 times | Joined on Apr 2010 @ Czech Republic
#51
Originally Posted by nahci13 View Post
Hello all!
I want installing python for example version 2.7 or 3.2 on my N900.
I installed and every think is ok, but how I can new version installed set on default python to run?
for example after install python v2.7 when I type in x-terminal "python" I see old version(2.5)! every time I must type "python2.7 xxx.py" for run?
How I can replace new version with old version? when type and run "python" in x-terminal run python v2.7?

Thank you
Note that code that is working with 2.5 might not work with 2.7 and even less will work with 3.2 out of the box. That's also the reason for the python<version> commands, as applications might expect Python 2.5 as it is the default.
__________________
modRana: a flexible GPS navigation system
Mieru: a flexible manga and comic book reader
Universal Components - a solution for native looking yet component set independent QML appliactions (QtQuick Controls 2 & Silica supported as backends)
 
Posts: 838 | Thanked: 3,384 times | Joined on Mar 2009
#52
Originally Posted by nahci13 View Post
How I can replace new version with old version? when type and run "python" in x-terminal run python v2.7?
As stated it might not be safe to do, but using terminal
Code:
root
rm /usr/bin/python
ln -s python2.7 /usr/bin/python
exit
Explanation: /usr/bin/python is symlink to the python2.5 (you can see that with 'ls -al /usr/bin/python'). rm deletes old symlink, and ln -s creates it again but pointing to the python2.7

---
Better way is to start your script.py -file with row:
Code:
#! /usr/bin/env python2.7
And then 'chmod +x script.py' it and start it with './script.py', or if it is in the path just 'script.py'.
 

The Following 5 Users Say Thank You to AapoRantalainen For This Useful Post:
Posts: 3,328 | Thanked: 4,476 times | Joined on May 2011 @ Poland
#53
Or use
Code:
python2.7 /path/to/script.py
__________________
If you want to support my work, you can donate by PayPal or Flattr

Projects no longer actively developed: here
 

The Following 2 Users Say Thank You to marmistrz For This Useful Post:
Posts: 1,203 | Thanked: 3,027 times | Joined on Dec 2010
#54
In the long term, when more packages require 2.7 or 3.x the default python symlink would be updated but as for now the env option is probably the best to avoid breaking other apps.
 

The Following User Says Thank You to Android_808 For This Useful Post:
Posts: 3,328 | Thanked: 4,476 times | Joined on May 2011 @ Poland
#55
Originally Posted by Android_808 View Post
In the long term, when more packages require 2.7 or 3.x the default python symlink would be updated but as for now the env option is probably the best to avoid breaking other apps.
First libraries such as pyqt or pyside would have to be build against 2.7 (as python2 and python3 aren't compatible)
__________________
If you want to support my work, you can donate by PayPal or Flattr

Projects no longer actively developed: here
 

The Following User Says Thank You to marmistrz For This Useful Post:
Posts: 262 | Thanked: 315 times | Joined on Jun 2010
#56
Does anyone have pip working on N900? I'd like to install an app called 'jrnl' which is available through pip.
 
Posts: 804 | Thanked: 1,598 times | Joined on Feb 2010 @ Gdynia, Poland
#57
https://hackerone.com/reports/12297 - security issue found in python (2.7 and newer), there is also code which can check if our version is vulnerable (I don't have 2.7 on my device I think, so I cannot test your build) and patch available.
 

The Following 2 Users Say Thank You to misiak For This Useful Post:
Posts: 3,328 | Thanked: 4,476 times | Joined on May 2011 @ Poland
#58
Is this normal?

Code:
$ sudo apt-get install python2.7
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following extra packages will be installed:
  python2.7-minimal
Suggested packages:
  python2.7-doc binutils binfmt-support
The following NEW packages will be installed:
  python2.7 python2.7-minimal
0 upgraded, 2 newly installed, 0 to remove and 1 not upgraded.
Need to get 0B/4098kB of archives.
After this operation, 15,2MB of additional disk space will be used.
Do you want to continue [Y/n]? y
Selecting previously deselected package python2.7-minimal.
(Reading database ... 52018 files and directories currently installed.)
Unpacking python2.7-minimal (from .../python2.7-minimal_2.7.3~rc2-2.1-maemo9_armel.deb) ...
Selecting previously deselected package python2.7.
Unpacking python2.7 (from .../python2.7_2.7.3~rc2-2.1-maemo9_armel.deb) ...
Setting up python2.7-minimal (2.7.3~rc2-2.1-maemo9) ...
python2.7: can't open file '/usr/lib/python2.7/py_compile.py': [Errno 2] No such file or directory
Linking and byte-compiling packages for runtime python2.7...
INFO: using unknown version '/usr/bin/python2.7' (debian_defaults not up-to-date?)
rmdir /var/lib/python
Setting up python2.7 (2.7.3~rc2-2.1-maemo9) ...
python2.7: can't open file '/usr/lib/python2.7/py_compile.py': [Errno 2] No such file or directory
and after installing `import ssl` fails (ssl not defined)
__________________
If you want to support my work, you can donate by PayPal or Flattr

Projects no longer actively developed: here

Last edited by marmistrz; 2014-09-04 at 18:40.
 
Posts: 238 | Thanked: 131 times | Joined on May 2011 @ Bulgaria
#59
HI Marmistrz,i haven't any problems with installing python2.7,but i install two packages python2.7-minimal and python2.7-examples,why you don't try with:
sudo gainroot
mkdir -p /usr/lib/python2.7
apt-get install --reinstall python2.7-minimal
apt-get install python2.7-examples
for now only with this i can help you

regards

Last edited by disappear; 2014-09-05 at 13:57.
 
Posts: 3,328 | Thanked: 4,476 times | Joined on May 2011 @ Poland
#60
OK, noticed that py_compile.py is in /usr/lib/python2.7/python2.7

removed the package, moved /usr/lib/python2.7 and install back again, worked like charm. Seems like bug in postinst or somewhere else.
__________________
If you want to support my work, you can donate by PayPal or Flattr

Projects no longer actively developed: here

Last edited by marmistrz; 2014-09-05 at 17:31.
 
Reply


 
Forum Jump


All times are GMT. The time now is 10:20.