U
Uwe Rangs
Hello,
how can I change the default version of python with os x 10.7.
Thanks,
Uwe
how can I change the default version of python with os x 10.7.
Thanks,
Uwe
Hello,
how can I change the default version of python with os x 10.7.
Thanks,
Uwe
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.
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.