带有原生Python 2.6的Py2app [英] Py2app with native Python 2.6

查看:119
本文介绍了带有原生Python 2.6的Py2app的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个主要依赖于matplotlib,tkinter,numpy和scipy的python应用程序,我已经为多个操作系统分发了该程序.我将它们构建在python 2.6的python.org版本之上.对于Mac,过去我使用py2app和pyinstaller取得了很大的成功,以构建我的应用程序的独立版本.但是,最近,我包含了需要patsy,pandas和igraph的函数,并且不得不移动到python 2.6的mac分布式版本才能使igraph正常工作.在Mac上为我的OS(10.6)在Mac上构建软件的py2app版本时,所有方法都工作正常,但是当我在10.8上运行时,遇到以下错误:

I have a python application primarily dependent on matplotlib, tkinter, numpy and scipy I have been distributing for multiple operating systems. I build these on top of the python.org version of python 2.6. For mac, I have had good success in the past with py2app and pyinstaller to build standalone versions of my application. Recently, however, I have included functions that require patsy, pandas and igraph and have had to move to the mac distributed version of python 2.6 in order to get igraph to work. All works fine in building a py2app version of my software on the Mac for my OS (10.6) but when I run on 10.8 I encountered the following error:

Traceback (most recent call last):
 File "UI.pyc", line 603 createHeatMap
 File "clustering.pyc", line 31, in <module>
 File "mpl_toolkits/__init__.pyc", line 2, in <module>
 File "/System/Library/Frameworks/Python.framework/Versions/2.6/Extras/lib/python/pkg_resources.py", line 698, in <module>
 File "/System/Library/Frameworks/Python.framework/Versions/2.6/Extras/lib/python/pkg_resources.py", line 701, in Environment
 File "/System/Library/Frameworks/Python.framework/Versions/2.6/Extras/lib/python/pkg_resources.py", line 96, in get_supported_platform
 File "/System/Library/Frameworks/Python.framework/Versions/2.6/Extras/lib/python/pkg_resources.py", line 222, in get_build_platform
 File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/distutils/util.py", line 98, in get_platform
 File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/distutils/sysconfig.py", line 537, in get_config_vars
 File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/distutils/sysconfig.py", line 405, in _init_posix
DistutilsPlatformError: invalid Python installation: unable to open /user/include/python2.6/pyconfig.h (No such file or directory)

此问题的解决方法是将pyconfig.h文件保存到目标计算机上的指定位置(在10.8中不存在,但在10.6中存在),这使我的应用程序可以正常工作.在我的py2app pacakge目录中的目录/资源"下,有一个指向目录包含"的符号链接,它指向:/System/Library/Frameworks/Python.framework/Versions/2.6/include/python2.6/pyconfig .H.如果我将pyconfig.h文件作为附加资源包含在我的py2app设置文件中,则它也将其包含在包中,但仍然无法识别.

This is fixed by saving the file pyconfig.h to the designated location on the destination machine (not present in 10.8 but present in 10.6), which allows my application to work fine. In my py2app pacakge directory, under "Contents/Resources" there is a sym-link to the directory "include" which points to: /System/Library/Frameworks/Python.framework/Versions/2.6/include/python2.6/pyconfig.h. If I include the pyconfig.h file as an addition resource in my py2app setup file, it also includes it in the package, but it still is not recognized.

有人可以为此建议一个好方法吗,它不需要我使用python.org版本的python(我很幸运让igraph可以使用它.)

Can anyone suggest a good work around for this that doesn't require me to use the python.org version of python (I've had horrible luck getting igraph to work with this).

谢谢...

推荐答案

这是py2app中的一个已知问题,请参见

This is a known issue in py2app, see https://bitbucket.org/ronaldoussoren/py2app/issue/36/py2app-fails-to-build-a-working-executable. The pyconfig.h file is only present on machines where the developer tools are installed, which is why I haven't noticed the problem myself.

最简单的解决方法可能是在创建应用包后用文件副本替换pyconfig.h符号链接.

The easiest workaround is probably to replace the pyconfig.h symlink by a copy of the file after creating the app bundle.

这篇关于带有原生Python 2.6的Py2app的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆