PyInstaller:“ImportError:没有名为os的模块”

2024-09-28 21:04:22 发布

您现在位置:Python中文网/ 问答频道 /正文

我在学PyInstaller。我创建了两个简单的文件,测试.py公司名称:

import os

以及测试规范公司名称:

^{pr2}$

然后我跑了:

Build.py Test.spec

它运行时没有任何错误消息,并生成了一个包含多个文件的目录dist,包括测试.exe. 当我跑的时候测试.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.

我真的犯了些愚蠢的错误?在


Tags: and文件pytestimport名称settingsos