2011-06-10 203 views
0

我正在尝试学习PyInstaller。我创建了两个简单的文件,Test.py:PyInstaller:“ImportError:No module named os”

import os 

和Test.spec:

anal = Analysis (["Test.py"]) 
pyz = PYZ(anal.pure) 
exe = EXE(anal.scripts, pyz, name="Test.exe", exclude_binaries=1, debug=1) 
coll = COLLECT(exe, anal.binaries, name="dist") 

然后我跑:

Build.py Test.spec 

此运行,没有任何错误mesages,并产生了目录dist与几个文件,包括Test.exe。当我跑将Test.exe,它未能与输出:

Found embedded PKG: C:\Documents and Settings\Rade\My Documents\Development\Test\Test.exe 
Extracting binaries 
manifestpath: C:\Documents and Settings\Rade\My Documents\Development\Test\Test. 
exe.manifest 
Error activating the context 
python27.dll 
Manipulating evironment 
PYTHONPATH=C:/Documents and Settings/Rade/My Documents/Development/Test 
importing modules from CArchive 
extracted iu 
extracted struct 
extracted archive 
Installing import hooks 
outPYZ1.pyz 
Running scripts 
Traceback (most recent call last): 
    File "<string>", line 1, in <module> 
ImportError: No module named os 
RC: -1 from Test 
OK. 

我敢肯定,我已经取得了一些愚蠢的初学者的错误,但什么?

+0

进出口运行到同样的问题,我也产生通过Makespec.py :( – Cmag 2011-09-15 18:52:39

回答