View previous topic :: View next topic |
Author |
Message |
solamour l33t
Joined: 21 Dec 2004 Posts: 698 Location: San Diego, CA
|
Posted: Sun Nov 11, 2012 8:36 am Post subject: [Solved] Q: Use python 2.7 when 3.2 is set to default |
|
|
I have python 3.2 as default.
Code: | # eselect python list
Available Python interpreters:
[1] python2.6
[2] python2.7
[3] python3.2 *
|
Everything works fine, except "repo" command for Android development, which is not compatible with python 3.x (Google says so http://source.android.com/source/building.html).
In a given bash session, is there a way to use python v2.7 as default in that particular session without making any changes to the system's default setting?
__
sol
Last edited by solamour on Sun Nov 11, 2012 10:30 pm; edited 1 time in total |
|
Back to top |
|
|
chithanh Developer
Joined: 05 Aug 2006 Posts: 2158 Location: Berlin, Germany
|
Posted: Sun Nov 11, 2012 1:34 pm Post subject: |
|
|
Note that your link only says that python-2 must be installed, not that it must be set as default.
Normally it is sufficient to change the shebang lines of affected python scripts from Code: | #!/usr/bin/env python | to Code: | #!/usr/bin/env python2 | If that is not feasible in your case, you can set the environment variable EPYTHON="python2.7" but that is not guaranteed to work without problems. |
|
Back to top |
|
|
solamour l33t
Joined: 21 Dec 2004 Posts: 698 Location: San Diego, CA
|
Posted: Sun Nov 11, 2012 10:30 pm Post subject: |
|
|
When I run "repo" command, it downloads other python scripts, which in turn require python 2.x, so making changes to the script itself turned out to be more hassle.
But "export EPYTHON=python2.7" did the trick. Everything is working well now. Thank you. I believe "EPYTHON" is gentoo-specific environment variable, yes?
__
sol |
|
Back to top |
|
|
yngwin Retired Dev
Joined: 19 Dec 2002 Posts: 4572 Location: Suzhou, China
|
Posted: Mon Nov 12, 2012 4:04 am Post subject: |
|
|
Why don't you set 2.7 as the default? In my opinion python3 is still not ready for prime-time. I would even completely get rid of the other versions, if I were you, unless you use something that specifically needs 3.2. _________________ "Those who deny freedom to others deserve it not for themselves." - Abraham Lincoln
Free Culture | Defective by Design | EFF |
|
Back to top |
|
|
solamour l33t
Joined: 21 Dec 2004 Posts: 698 Location: San Diego, CA
|
Posted: Mon Nov 12, 2012 6:36 am Post subject: |
|
|
yngwin wrote: | Why don't you set 2.7 as the default? In my opinion python3 is still not ready for prime-time. |
Agreed. There are too many things out there that are not playing nicely with python 3 (Django, for example). That said, I believe python 3 is where we are headed (http://wiki.python.org/moin/Python2orPython3), and if I'm going to be there eventually, I might as well start sooner rather than later.
Besides, other than this "repo" thingy, I didn't have much trouble using python 3 as the default. Then again, I'm just starting to learn, so I don't have much to lose anyway.
__
sol |
|
Back to top |
|
|
|