Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #16987
| From | Ned Deily <nad@acm.org> |
|---|---|
| Subject | Re: Using python on OS X Lion |
| Date | 2011-12-11 13:00 -0800 |
| References | <CAGZ55DT6XqbrDt-vwgcZsySTyZ=_QxHzPc8f=X0NMRs=fCtT=w@mail.gmail.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.3517.1323637343.27778.python-list@python.org> (permalink) |
In article
<CAGZ55DT6XqbrDt-vwgcZsySTyZ=_QxHzPc8f=X0NMRs=fCtT=w@mail.gmail.com>,
Johann Spies <johann.spies@gmail.com> wrote:
> I have recently upgraded my Snow Leopard to Lion and now I am having all
> problems with python on my system e.g.:
>
> I have install PIL with easy_install but when I do
>
> import PIL
>
> Python cannot find the pil library. Installing psycopg2 in the same way was
> successful and I can use psycopg2 without a problem.
>
> Further, the new version of Python is 2.7.1 in Lion. But when I just run
> 'python' it calls up 2.6.5 - even after I have moved the application
> python2.6 to Trash.
>
> I see several guidelines for using python on OS X: some using macports,
> others homebrew and others 'pip' and 'virtualenv' . I come from a Linux
> background where a proper packaging system like apt (on Debian) prevent
> these types of problems.
>
> So my question: What is the recommended way of setting up a python
> environment in OS X?
>
> And how do I get rid of legacy python libraries on my system?
First, determine which python is being loaded. In OS X 10.7 (Lion),
Apple ships 2.7.1, 2.6.7, and 2.5.6 version of Python (all in /usr/bin)
so the 2.6.5 is coming from elsewhere. If you previously installed a
Python from a python.org installer, the framework will be in
/Library/Frameworks/Python.framework (and *not*
/System/Library/Frameworks, which is where Apple's Pythons are and
should not be modified). The python.org installers, by default, may
modify your shell profiles (i.e. .bash_profile, .profile, et al) to
prepend its framework bin directory to your shell PATH. Look for
something like this:
# Setting PATH for MacPython 2.6
# The orginal version is saved in .profile.pysave
PATH="/Library/Frameworks/Python.framework/Versions/2.6/bin:${PATH}"
export PATH
There are more details here http://bugs.python.org/issue7107
Also understand that if you use easy_install or pip, each Python
instance needs to have its own version of either one. Apple supplies
versions of easy_install in /usr/bin for its Pythons. If you install
another version of Python, you'll need to install another easy_install
and pip for it as well.
--
Ned Deily,
nad@acm.org
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: Using python on OS X Lion Ned Deily <nad@acm.org> - 2011-12-11 13:00 -0800
csiph-web