【发布时间】:2015-04-30 15:54:56
【问题描述】:
我正在尝试在未安装 python 的系统上运行 python 文件。我正在使用 py2exe,它为我提供了一个在我的系统上运行良好的 .pyc 文件,但是当我将它提供给没有使用 python 的朋友时,它告诉他 Windows 无法运行该文件。
我的setup.py 文件包含这个;
from distutils.core import setup
import py2exe
setup(console=['PyVersionControl.py'])
当我在命令行中运行 py2exe 时,这是输出
Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation. All rights reserved.
C:\Users\chdick>python setup.py py2exe
running py2exe
3 missing Modules
------------------
? readline imported from cmd, code, pdb
? win32api imported from platform
? win32con imported from platform
Building 'dist\PyVersionControl.exe'.
Building shared code archive 'dist\library.zip'.
Copy c:\windows\system32\python34.dll to dist
Copy C:\Python34\DLLs\pyexpat.pyd to dist\pyexpat.pyd
Copy C:\Python34\DLLs\_ctypes.pyd to dist\_ctypes.pyd
Copy C:\Python34\DLLs\unicodedata.pyd to dist\unicodedata.pyd
Copy C:\Python34\DLLs\_hashlib.pyd to dist\_hashlib.pyd
Copy C:\Python34\DLLs\_socket.pyd to dist\_socket.pyd
Copy C:\Python34\DLLs\_tkinter.pyd to dist\_tkinter.pyd
Copy C:\Python34\DLLs\_bz2.pyd to dist\_bz2.pyd
Copy C:\Python34\DLLs\select.pyd to dist\select.pyd
Copy C:\Python34\DLLs\_ssl.pyd to dist\_ssl.pyd
Copy C:\Python34\DLLs\_lzma.pyd to dist\_lzma.pyd
Copy DLL C:\Python34\DLLs\tk86t.dll to dist\
Copy DLL C:\Python34\DLLs\tcl86t.dll to dist\
C:\Users\chdick>
【问题讨论】:
-
你检查过this吗?
-
嗯,
py2exe的重点是创建.exe对象。如果您只给您的朋友.pyc对象,那么是的,如果没有安装 Python,他们就无法运行它。