Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #52704 > unrolled thread
| Started by | Uwe Rangs <uwe.rangs@fernuni-hagen.de> |
|---|---|
| First post | 2013-08-19 22:14 +0200 |
| Last post | 2013-08-19 16:46 -0400 |
| Articles | 6 — 4 participants |
Back to article view | Back to comp.lang.python
default python os x Uwe Rangs <uwe.rangs@fernuni-hagen.de> - 2013-08-19 22:14 +0200
Re: default python os x Uwe Rangs <uwe.rangs@fernuni-hagen.de> - 2013-08-19 22:24 +0200
Re: default python os x Steven D'Aprano <steve@pearwood.info> - 2013-08-20 05:39 +0000
Re: default python os x Uwe Rangs <uwe.rangs@fernuni-hagen.de> - 2013-08-20 09:01 +0200
Re: default python os x Cameron Simpson <cs@zip.com.au> - 2013-08-21 20:22 +1000
Re: default python os x Joel Goldstick <joel.goldstick@gmail.com> - 2013-08-19 16:46 -0400
| From | Uwe Rangs <uwe.rangs@fernuni-hagen.de> |
|---|---|
| Date | 2013-08-19 22:14 +0200 |
| Subject | default python os x |
| Message-ID | <kutuac$sck$1@news-ailanthus.fernuni-hagen.de> |
Hello, how can I change the default version of python with os x 10.7. Thanks, Uwe
[toc] | [next] | [standalone]
| From | Uwe Rangs <uwe.rangs@fernuni-hagen.de> |
|---|---|
| Date | 2013-08-19 22:24 +0200 |
| Message-ID | <kutuue$rh$1@news-ailanthus.fernuni-hagen.de> |
| In reply to | #52704 |
My workflow at the moment is to set a link: mv python python_old ln -s /usr/local/bin/python3.2 python But is this a good idea? -- Uwe On 2013-08-19 20:14:04 +0000, Uwe Rangs said: > Hello, > > how can I change the default version of python with os x 10.7. > > Thanks, > Uwe
[toc] | [prev] | [next] | [standalone]
| From | Steven D'Aprano <steve@pearwood.info> |
|---|---|
| Date | 2013-08-20 05:39 +0000 |
| Message-ID | <5213012b$0$29885$c3e8da3$5496439d@news.astraweb.com> |
| In reply to | #52706 |
On Mon, 19 Aug 2013 22:24:46 +0200, Uwe Rangs wrote: > My workflow at the moment is to set a link: mv python python_old > ln -s /usr/local/bin/python3.2 python > > But is this a good idea? You should never change the system Python, since that runs the risk of breaking system tools that expect a particular version. If there are any system tools that run "python", they may break. Instead, set a personal alias. For example, in my ~/.bashrc file, I have the following: export PYTHONPATH="/home/steve/python/:/home/steve/python/utilities" export PYTHONSTARTUP=/home/steve/python/utilities/startup.py alias python=python2.7 alias python3=python3.3 alias python1.5='env -u PYTHONSTARTUP python1.5' alias python2.0='env -u PYTHONSTARTUP python2.0' alias python2.1='env -u PYTHONSTARTUP python2.1' alias python2.2='env -u PYTHONSTARTUP python2.2' alias python2.3='env -u PYTHONSTARTUP python2.3' alias python3.4="env -u PYTHONPATH ~/python/cpython/python" So, for me, and me alone, typing "python" refers to Python 2.7 instead of the system Python, which happens to be 2.4 on my server and 2.6 on my laptop. "python1.5" etc unsets the startup file environment variable, since my startup file assumes 2.4 or better. "python3.4" points to a local copy in my home directory. Otherwise, python3.3, python3.2, etc. work as expected. -- Steven
[toc] | [prev] | [next] | [standalone]
| From | Uwe Rangs <uwe.rangs@fernuni-hagen.de> |
|---|---|
| Date | 2013-08-20 09:01 +0200 |
| Message-ID | <kuv47h$447$1@news-ailanthus.fernuni-hagen.de> |
| In reply to | #52714 |
Ah, I see. Thank you! On 2013-08-20 05:39:56 +0000, Steven D'Aprano said: > On Mon, 19 Aug 2013 22:24:46 +0200, Uwe Rangs wrote: > >> My workflow at the moment is to set a link: mv python python_old >> ln -s /usr/local/bin/python3.2 python >> >> But is this a good idea? > > > You should never change the system Python, since that runs the risk of > breaking system tools that expect a particular version. If there are any > system tools that run "python", they may break. > > Instead, set a personal alias. For example, in my ~/.bashrc > file, I have the following: > > > export PYTHONPATH="/home/steve/python/:/home/steve/python/utilities" > export PYTHONSTARTUP=/home/steve/python/utilities/startup.py > alias python=python2.7 > alias python3=python3.3 > alias python1.5='env -u PYTHONSTARTUP python1.5' > alias python2.0='env -u PYTHONSTARTUP python2.0' > alias python2.1='env -u PYTHONSTARTUP python2.1' > alias python2.2='env -u PYTHONSTARTUP python2.2' > alias python2.3='env -u PYTHONSTARTUP python2.3' > alias python3.4="env -u PYTHONPATH ~/python/cpython/python" > > > So, for me, and me alone, typing "python" refers to Python 2.7 instead of > the system Python, which happens to be 2.4 on my server and 2.6 on my > laptop. "python1.5" etc unsets the startup file environment variable, > since my startup file assumes 2.4 or better. "python3.4" points to a > local copy in my home directory. Otherwise, python3.3, python3.2, etc. > work as expected.
[toc] | [prev] | [next] | [standalone]
| From | Cameron Simpson <cs@zip.com.au> |
|---|---|
| Date | 2013-08-21 20:22 +1000 |
| Message-ID | <mailman.76.1377080556.19984.python-list@python.org> |
| In reply to | #52721 |
On 20Aug2013 09:01, Uwe Rangs <uwe.rangs@fernuni-hagen.de> wrote:
| Ah, I see. Thank you!
Please don't top post. Thanks.
| On 2013-08-20 05:39:56 +0000, Steven D'Aprano said:
| >alias python1.5='env -u PYTHONSTARTUP python1.5'
I should point out that -u is a GNU env feature. It is not portable,
and in particular OSX "env" does not have it.
A shell function can do the same though:
py20() {
( unset PYTHONSTARTUP
exec python2.0 ${1+"$@"}
)
}
I've said py20 instead of python2.0 primarily because bash is a
bit... picky about function names and rejected the ".".
Cheers,
--
Cameron Simpson <cs@zip.com.au>
But pessimism IS realism! - D.L.Bahr
[toc] | [prev] | [next] | [standalone]
| From | Joel Goldstick <joel.goldstick@gmail.com> |
|---|---|
| Date | 2013-08-19 16:46 -0400 |
| Message-ID | <mailman.41.1376945197.19984.python-list@python.org> |
| In reply to | #52704 |
On Mon, Aug 19, 2013 at 4:14 PM, Uwe Rangs <uwe.rangs@fernuni-hagen.de> wrote: > Hello, > > how can I change the default version of python with os x 10.7. > > Thanks, > Uwe > > -- > http://mail.python.org/mailman/listinfo/python-list You might want to look at this: http://stackoverflow.com/questions/5846167/how-to-change-default-python-version -- Joel Goldstick http://joelgoldstick.com
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.python
csiph-web