尝试运行使用cx_Freeze生成的.exe时出现以下错误:
ImportError:没有名为' pythoncom'
的模块我该如何解决这个问题?
import os
import sys
from cx_Freeze import setup, Executable
os.environ['TCL_LIBRARY'] = r"C:\WinPython-64bit-3.5.2.3Qt5\python-3.5.2.amd64\tcl\tcl8.6"
os.environ['TK_LIBRARY'] = r"C:\WinPython-64bit-3.5.2.3Qt5\python-3.5.2.amd64\tcl\tk8.6"
base = 'Console'
if sys.platform == 'win32':
base = 'Win32GUI'
options = {
'build_exe': {
'excludes': ['gtk', 'PyQt4', 'Tkinter'],
'includes': ['pythoncom']
}
}
executables = [
Executable('GUI.py', base=base)
]
setup(name='GUI',
version='0.1',
description='GUI test',
executables=executables,
options=options
)
*部分内容
from bs4 import BeautifulSoup
import requests
import win32com.client, pythoncom
from PyQt5 import QtCore, QtGui, QtWidgets
from matplotlib import use as MPLuse
MPLuse("Qt5Agg",force=True)
from matplotlib.backends.backend_qt5agg import FigureCanvasQTAgg as FigureCanvas
from matplotlib.backends.backend_qt5agg import NavigationToolbar2QT as NavigationToolbar
from matplotlib.figure import Figure
import seaborn as sns
m pythoncom C:\WinPython-64bit-3.5.2.3Qt5\python-3.5.2.amd64\pythoncom35.dll
...
copying C:\WinPython-64bit-3.5.2.3Qt5\python-3.5.2.amd64\pythoncom35.dll -> build\exe.win-amd64-3.5\pythoncom35.dll
..
P pywin C:\WinPython-64bit-3.5.2.3Qt5\python-3.5.2.amd64\lib\site-packages\Pythonwin\pywin\__init__.py
P pywin.dialogs C:\WinPython-64bit-3.5.2.3Qt5\python-3.5.2.amd64\lib\site-packages\Pythonwin\pywin\dialogs\__init__.py
m pywin.dialogs.list C:\WinPython-64bit-3.5.2.3Qt5\python-3.5.2.amd64\lib\site-packages\Pythonwin\pywin\dialogs\list.py
m pywin.dialogs.status C:\WinPython-64bit-3.5.2.3Qt5\python-3.5.2.amd64\lib\site-packages\Pythonwin\pywin\dialogs\status.py
P pywin.mfc C:\WinPython-64bit-3.5.2.3Qt5\python-3.5.2.amd64\lib\site-packages\Pythonwin\pywin\mfc\__init__.py
m pywin.mfc.dialog C:\WinPython-64bit-3.5.2.3Qt5\python-3.5.2.amd64\lib\site-packages\Pythonwin\pywin\mfc\dialog.py
m pywin.mfc.object C:\WinPython-64bit-3.5.2.3Qt5\python-3.5.2.amd64\lib\site-packages\Pythonwin\pywin\mfc\object.py
m pywin.mfc.thread C:\WinPython-64bit-3.5.2.3Qt5\python-3.5.2.amd64\lib\site-packages\Pythonwin\pywin\mfc\thread.py
m pywin.mfc.window C:\WinPython-64bit-3.5.2.3Qt5\python-3.5.2.amd64\lib\site-packages\Pythonwin\pywin\mfc\window.py
m pywintypes C:\WinPython-64bit-3.5.2.3Qt5\python-3.5.2.amd64\pywintypes35.dll
..
copying C:\WinPython-64bit-3.5.2.3Qt5\python-3.5.2.amd64\pywintypes35.dll -> build\exe.win-amd64-3.5\pywintypes35.dll
无
'includes': ['pythoncom']
的情况下构建。结果是一样的。'packages': ['pythoncom']
构建。结果是一样的。'includes': ['pywin32']
构建。在构建期间将获得ImportError: No module named 'pywin32'
。'packages': ['pywin32']
构建。在构建期间将获得ImportError: No module named 'pywin32'
。