当我尝试为现有 Pylons 应用程序提供服务时出现 PasteScript 错误

发布于 2024-10-02 18:59:04 字数 862 浏览 1 评论 0原文

我正在尝试在 OS X Snow Leopard 上提供现有的 Python 2.5 Pylons 应用程序。

我已经安装了 Python 2.5 并将其设置为默认的 Python 安装,安装了 Paster,并安装了应用程序所需的 Pylons 版本(0.9.6.1)以及其他鸡蛋...但是当我 cd 到主文件夹并执行“pasterservedevelopment.ini”时,我得到以下信息:

File "/usr/local/bin/paster", line 5, in <module>
    from pkg_resources import load_entry_point

File "/System/Library/Frameworks/Python.framework/Versions/2.5/Extras/lib/python/pkg_resources.py", line 2603, in <module>

File "/System/Library/Frameworks/Python.framework/Versions/2.5/Extras/lib/python/pkg_resources.py", line 666, in require

File "/System/Library/Frameworks/Python.framework/Versions/2.5/Extras/lib/python/pkg_resources.py", line 565, in resolve

pkg_resources.DistributionNotFound: PasteScript==1.7.3

我肯定已经完成了“easy_installPasteScript==1.7.3”,但仍然收到此错误。我真的缺少什么明显的东西吗?帮助?

提前致谢。

I'm trying to serve an existing Python 2.5 Pylons application on OS X Snow Leopard.

I've already installed Python 2.5 and set it as the default Python installation, installed paster, and installed the version of Pylons the app needs (0.9.6.1) as well as other eggs... but when I cd to the main folder and do "paster serve development.ini" I get the following:

File "/usr/local/bin/paster", line 5, in <module>
    from pkg_resources import load_entry_point

File "/System/Library/Frameworks/Python.framework/Versions/2.5/Extras/lib/python/pkg_resources.py", line 2603, in <module>

File "/System/Library/Frameworks/Python.framework/Versions/2.5/Extras/lib/python/pkg_resources.py", line 666, in require

File "/System/Library/Frameworks/Python.framework/Versions/2.5/Extras/lib/python/pkg_resources.py", line 565, in resolve

pkg_resources.DistributionNotFound: PasteScript==1.7.3

I definitely have done "easy_install PasteScript==1.7.3" and I still get this error. Is there something really obvious I'm missing? Help?

Thanks in advance.

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

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

发布评论

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

评论(4

朦胧时间 2024-10-09 18:59:04

您的系统上可能安装了多个 Python。 easy_install 命令可能将 PasteScript 安装到不同的 Python 解释器中。您可能有一个特定的 easy_install-2.5 命令,您应该将其用于 Python 2.5 解释器。

但是,强烈建议在您的开发系统上使用 virtualenv。

Virtualenv 允许您创建绑定到特定 Python 解释器的沙箱,并且您可以在其中根据每个项目在本地安装特定的软件包版本。

有关将 virtualenv 与 Pylons 一起使用的更多信息,请参见此处:
http://wiki.pylonshq.com/display/pylonscookbook/Using+a +Virtualenv+沙箱

You probably have multiple Python installs on your system. The easy_install command probably installed PasteScript into a different Python interpreter. You may have a specific easy_install-2.5 command that you should use instead for the Python 2.5 interpreter.

However, using virtualenv on your development system is strongly recommended.

Virtualenv allows you to create a sandbox bound to a specific Python interpreter, and where you can install specific packages versions locally based the on each project.

More information on using virtualenv with Pylons here:
http://wiki.pylonshq.com/display/pylonscookbook/Using+a+Virtualenv+Sandbox

吃素的狼 2024-10-09 18:59:04

也许这个答案太简单了,但我会尝试安装到特定版本 easy_install-2.5 PasteScript==1.7.3 请参阅轻松安装文档了解详细信息。

Perhaps this is too simple an answer, but I'd try installing to the specific version easy_install-2.5 PasteScript==1.7.3 See Easy install docs for details.

慈悲佛祖 2024-10-09 18:59:04

编辑 /usr/sbin/luci 中的第一行,然后将 python 版本添加到以下行:

#!/usr/bin/python -Es

编辑 /usr/bin/paster 中的第一行,然后添加python 的版本到以下行:

#!/usr/bin/python

Edit first line in /usr/sbin/luci, and then add the version of python to the below line:

#!/usr/bin/python -Es

Edit first line in /usr/bin/paster and then add the version of python to the below line:

#!/usr/bin/python
岁月如刀 2024-10-09 18:59:04

即使我执行“paster --help”,我也会收到此错误。 PasteScript 位于我的 virtual-env 的站点包中,并且 PasteScript 显示在 pip freeze 中。问题在于 PasteScript 文件夹以 .dist-info 结尾。另一个名为 Distribution 的 Egg 已安装,它位于我的 sys.path 的前面。它有一个旧版本的 pkg_resources,它不知道“.dist-info”egg 文件夹。有问题的 pkg_resources 逻辑位于函数 find_on_path 中。您可以在 pkg_resources 中搜索“dist-info”。因此,即使安装了paste/script/command.py中的“pkg_resources.get_distribution('PasteScript')”,也没有发现PasteScript。要查找正在使用哪个 pkg_resources,您可以运行 python 并执行“import pkg_resources; print pkg_resources”。卸载“distribute”修复了我当前的错误(但随后我遇到了另一个错误)。

更新:我正在 Ubuntu Precision 上安装最新的 ckan 2.6.2(2017 年 4 月)(v12,有点旧,于 2012-2014 年发布)(使用 apt-get update 完全更新,通过 vagrant 映像 ubuntu/precise64 安装)。它坏了。使用图像 ubuntu/trusty64 效果很好。

I got this error even when I did "paster --help". PasteScript was in the site-packages of my virtual-env and PasteScript showed up in pip freeze. The problem was that the PasteScript folder ended in .dist-info. Another egg called distribute was installed and it was at the front of my sys.path. It had an older version of pkg_resources which did not know about ".dist-info" egg folders. The pkg_resources logic in question is in function find_on_path. You can search pkg_resources for "dist-info". So "pkg_resources.get_distribution('PasteScript')" in paste/script/command.py found no PasteScript even though it was installed. To find which pkg_resources is being used, you can run python and go "import pkg_resources; print pkg_resources". Uninstalling "distribute" fixed my current error (but then I hit another error).

Update: I was installing the latest ckan 2.6.2 (on Apr 2017) on Ubuntu precise (v12, a bit old, released in 2012-2014) (fully updated with apt-get update, installed via vagrant image ubuntu/precise64). It is broken. Using image ubuntu/trusty64 works perfectly.

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