在我的主脚本,让我们称这种MyScript.py,我有这样的:与py2exe一起使用psyco?
import psyco
psyco.full()
然后我setup.py看起来是这样的:
from distutils.core import setup
import py2exe, sys, os, glob
sys.argv.append('py2exe')
import psyco #speed up compilation
psyco.full()
def find_data_files(source,target,patterns):
"""Locates the specified data-files and returns the matches
in a data_files compatible format.
source is the root of the source data tree.
Use '' or '.' for current directory.
target is the root of the target data tree.
Use '' or '.' for the distribution directory.
patterns is a sequence of glob-patterns for the
files you want to copy.
"""
if glob.has_magic(source) or glob.has_magic(target):
raise ValueError("Magic not allowed in src, target")
ret = {}
for pattern in patterns:
pattern = os.path.join(source,pattern)
for filename in glob.glob(pattern):
if os.path.isfile(filename):
targetpath = os.path.join(target,os.path.relpath(filename,source))
path = os.path.dirname(targetpath)
ret.setdefault(path,[]).append(filename)
return sorted(ret.items())
setup(
name="MyScript",
version="1.0",
description="a script that does something",
author="Keelx",
data_files=find_data_files('.','',[
'gfx/*',
'data/*',
]),
options={'py2exe': {'bundle_files': 1,'optimize': 2}},
windows=[{'script': "MyScript.py"}],
zipfile=None,
)
它创建了一个 'DIST'文件夹,可执行文件,win9x可执行文件以及可执行文件旁边的gfx和数据文件夹。然而,当我运行它,它指向我的日志内容如下:
Traceback (most recent call last): File "MyScript.py", line 16, in File "zipextimporter.pyo", line 82, in load_module File "psyco__init__.pyo", line 64, in WindowsError: [Error 3] The system cannot find the path specified: 'C:\Documents and Settings\Keelx\Desktop\MyScriptFolder\dist\MyScript.exe\psyco\_psyco.pyd'
这似乎是在使用Psyco模块没有被放入可执行文件。我一直在寻找,我还没有找到一个工作解决方案来让py2exe复制psyco。
并且请不要根据'不要使用py2exe'来发布解决方案。
先谢谢你,谁可以帮我在这里。
是的,我试过,在一个点上,绝对没有影响。你愿意解释'包':''IPython']位? – Keelx
我在我的gtk应用程序中使用IPython作为开发控制台。它只是在软件包领域有一些东西。另一个尝试尝试是尝试让psyco成为蛋,而不是蛋。我相信在使用easy_install进行软件包编译或运行win32.exe安装程序时出现了一些问题。 – TelsaBoil