使用 macports 安装 matplotlib 时安装了额外的 python

发布于 2024-09-08 13:59:50 字数 896 浏览 1 评论 0原文

我在 mac os 10.6 上安装 matplotlib 时遇到问题,所以我使用了 macports 并安装了它所需的所有依赖项,这很棒,但除此之外还有一个新的 python 版本。现在我有两个 python 版本,这让我很困扰。 matplotlib 在 macport python 上运行良好,而我的其余部分则使用默认的 python。 将两者集成为一的最佳解决方案是什么?使用哪一个作为默认 python?

我尝试将默认 python /defaultPython/../site-packages 中的所有包复制到 /opt/../site-packages 中。同样的事情是在 macports python 的 PYTHONPATH 上添加 /defaultPython/../site-packages 。 有些确实工作得很好,但不是全部。

例如,

import scipy.sparse

我收到此错误

import _csr
ImportError: dlopen(/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/scipy/sparse/sparsetools/_csr.so, 2): no suitable image found.  Did find:
    /opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/scipy/sparse/sparsetools/_csr.so: no matching architecture in universal wrapper

对此有什么想法或肮脏的修复吗?

多谢!

I am having trouble installing matplotlib on mac os 10.6, so I used macports and installed all dependencies it needed, which is great, but on top of it a new python version. Now I have two python versions and that bothers me. The matplotlib is working fine on the macport python, and the rest of my stuff is with the default python.
What is the best solution for integrating both into one, and which one to use as the default python?

I tried copying all packages from my default python /defaultPython/../site-packages into the /opt/../site-packages. Same thing would be to add /defaultPython/../site-packages on the PYTHONPATH of macports python.
Some did work fine, but not all.

For example on

import scipy.sparse

I got this error

import _csr
ImportError: dlopen(/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/scipy/sparse/sparsetools/_csr.so, 2): no suitable image found.  Did find:
    /opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/scipy/sparse/sparsetools/_csr.so: no matching architecture in universal wrapper

Any thoughts or dirty fix for this?

Thanks a lot!

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

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

发布评论

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

评论(1

回眸一笑 2024-09-15 13:59:50

您永远不应该删除或更改 Apple 随 Mac OS X 提供的 Python 系统——这是他们测试其操作系统所使用的特定构建,您真的不想破坏它。

如果您想使用方便的 macports 安装的扩展,则需要 macports 版本的 Python 来实现此目的,因此您也无法删除它。

没有真正的理由担心,因为你的系统上有多个 Python 版本(我的系统上通常至少有六种;-)。

只需将 /opt/... (无论 macports 保存其 bin 目录的位置)放在 PATH 环境变量的开头(例如在 .bashrc 中) )并确保使用 macports Python 安装您需要的任何扩展。

You should never remove or alter the system Python that Apple supplies with Mac OS X -- that's the specific build they've tested their OS with, and you really don't want to break that.

If you want to use handy macports-installed extensions, you need the macports version of Python for that purpose, so you can't remove that either.

There is no real reason to worry because you have more than one Python version on your system (I typically have at least half a dozen on mine;-).

Just put /opt/... (wherever macports keeps its bin directory) at the start of your PATH environment variable (e.g. in .bashrc) and make sure you install with the macports Python any extension you need there.

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