Turbogears:更新到 mac osx 10.6 后无法启动 Paster

发布于 2024-08-07 12:27:03 字数 1050 浏览 6 评论 0原文

更新到 mac osx 10.6 后,我必须切换回 python 2.5 才能使虚拟环境正常工作。但我仍然无法开始我的涡轮齿轮项目。帕斯特给出了这个:

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'

有什么想法吗?谢谢。

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

—━☆沉默づ 2024-08-14 12:27:03

为什么需要切换回 2.5 才能使 virtualenv 正常工作?我已经升级到 10.6 并且很高兴在 Python 2.6 中使用 virtualenv。

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.

情域 2024-08-14 12:27:03

Eggs 可能是为 2.6 发行版安装的。请在终端中运行:

defaults write com.apple.versioner.python Version 2.5
export VERSIONER_PYTHON_VERSION=2.5
sudo easy_install virtualenv

查看第二行,它应该更改当前终端会话的 python 版本。

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) 
...

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) 
...
恍梦境° 2024-08-14 12:27:03

正如您所见,在 Snow Leopard 10.6 中,Apple 提供了 Python 2.6.2(/usr/bin/python 的默认值)和旧版 Python 2.5.4(/usr /bin/python2.5)。两者的核心都位于 /System/Library/Frameworks/Python.framework 中。一般来说,/System 下的所有内容均由 Apple 提供和管理;其他人不应该修改它。

如果该消息可信,则您的 10.6 安装有错误。

$ 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
>>>

检查该文件是否存在并且具有正确的权限。如果没有,您应该找出您的 /System 还有什么问题,并考虑从备份恢复或重新安装 Snow Leopard。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文