Turbogears: Can not start paster after updateing to mac osx 10.6
After updateing to mac osx 10.6 I had to switch back to python 2.5 in order to make virtual env work. But still I can not start my turbogears project. Paster is giving this :
Traceback (most recent call last):
File ".../tg2env/bin/paster", line 5, in <module>
from pkg_resources import load_entry_point
File ".../tg2env/lib/python2.5/site-packages/setuptools-0.6c9-py2.5.egg/pkg_resources.py", line 657, in <module>
File ".../tg2env/lib/python2.5/site-packages/setuptools-0.6c9-py2.5.egg/pkg_resources.py", line 660, in Environment
File ".../tg2env/lib/python2.5/site-packages/setuptools-0.6c9-py2.5.egg/pkg_resources.py", line 55, in get_supported_platform
File ".../tg2env/lib/python2.5/site-packages/setuptools-0.6c9-py2.5.egg/pkg_resources.py", line 186, in get_build_platform
File ".../tg2env/lib/python2.5/distutils/__init__.py", line 14, in <module>
exec open(os.path.join(distutils_path, '__init__.py')).read()
IOError: [Errno 2] No such file or directory: '/System/Library/Frameworks/Python.framework/Versions开发者_如何学运维/2.5/lib/python2.5/distutils/__init__.py'
Any ideas? Thanks.
Why did you need to switch back to 2.5 to make virtualenv work? I have upgraded to 10.6 and am happily using virtualenv in Python 2.6.
Probably eggs are installed for 2.6 distro. Please run in your terminal:
defaults write com.apple.versioner.python Version 2.5
export VERSIONER_PYTHON_VERSION=2.5
sudo easy_install virtualenv
Check out the second line, it should change python version for current terminal session.
dgl@dgl:~/ > python
Python 2.6.1 (r261:67515, Jul 7 2009, 23:51:51)
...
dgl@dgl:~/ > export VERSIONER_PYTHON_VERSION=2.5
dgl@dgl:~/ > python
Python 2.5.4 (r254:67916, Jul 7 2009, 23:51:24)
...
As you've seen, in Snow Leopard 10.6, Apple supplies both a Python 2.6.2 (the default for /usr/bin/python
) and a legacy Python 2.5.4 (/usr/bin/python2.5
). The heart of both live in the /System/Library/Frameworks/Python.framework
. In general, everything under /System
is supplied and managed by Apple; it should not be modified by anyone else.
If that message is to be believed, your 10.6 installation is faulty.
$ cd /System/Library/Frameworks/Python.framework/Versions
$ ls -l
total 8
drwxr-xr-x 5 root wheel 272 Sep 5 10:18 2.3/
drwxr-xr-x 9 root wheel 408 Sep 5 10:43 2.5/
drwxr-xr-x 9 root wheel 408 Sep 5 10:43 2.6/
lrwxr-xr-x 1 root wheel 3 Sep 5 10:18 Current@ -> 2.6
$ ls -l 2.5/lib/python2.5/distutils/__init__.py
-rw-r--r-- 1 root wheel 635 Jul 7 23:55 2.5/lib/python2.5/distutils/__init__.py
$ /usr/bin/python2.5
Python 2.5.4 (r254:67916, Jul 7 2009, 23:51:24)
[GCC 4.2.1 (Apple Inc. build 5646)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import distutils
>>>
Check to see that file exists and with the correct permissions. If not, you should figure out what else is wrong with your /System
and consider restoring from a backup or just reinstalling Snow Leopard.
精彩评论