将 py2app 与 Matplotlib 及其 Tex 格式一起使用?未找到 Dvipng

发布于 2024-09-19 06:33:18 字数 531 浏览 4 评论 0原文

我有一个应用程序放在 OS X 10.6 上的 py2app 中,它使用 Matplotlib 生成图形。 (使用 py2app 版本 0.5.3 和 matplotlib 版本 0.99.3,如果重要的话。)我启用了 Tex 格式化选项:

...
from matplotlib import rc
rc('text', usetex=True)
...

该脚本在命令行中执行时工作正常,包括 Tex 格式化。该应用程序是使用 py2app 创建的:

py2applet --make-setup MyApplication.py
python setup.py py2app

创建或打开应用程序时没有错误。但是,当我尝试在应用程序中生成绘图时,出现错误:

RuntimeError: Could not obtain dvipng version

是否因为 py2app 未在应用程序本身中包含 dvipng?解决这个问题的最佳方法是什么?

I have an application put together in py2app on OS X 10.6 which uses Matplotlib to generate graphs. (Using py2app version 0.5.3 and matplotlib version 0.99.3, if it matters.) I have the Tex formatting option enabled:

...
from matplotlib import rc
rc('text', usetex=True)
...

The script works fine when executed in the command line, including the Tex formatting. The application is created with py2app:

py2applet --make-setup MyApplication.py
python setup.py py2app

There are no errors in creating or opening the application. However, when I try to generate a plot in the application, I get the error:

RuntimeError: Could not obtain dvipng version

Is it because py2app is not including dvipng in the application itself? What's the best way to go about fixing this?

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

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

发布评论

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

评论(1

深爱不及久伴 2024-09-26 06:33:18

通过添加:

OPTIONS = {'argv_emulation': True, 'packages':['matplotlib']}

到我的 setup.py,当从命令行打开应用程序时,我可以使其正常工作。但奇怪的是,当通过其他方式打开时(例如,双击应用程序文件夹),我遇到了与开始时相同的问题。仍在寻找完整的修复方案。

By adding:

OPTIONS = {'argv_emulation': True, 'packages':['matplotlib']}

to my setup.py, I get this to work correctly when the application is opened from the command line. Strangely though, when opened by another means (double clicking in the applications folder, for example) I have the same problems I started with. Still looking for a full fix.

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