在我的主腳本,讓我們稱這種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