Pyinstaller "ImportError: No module named xml.etree"
Pyinstaller "ImportError: No module named xml.etree"
我正在使用命令:pyinstaller --onefile fileslook.py
这是我的 fileslook.py
的导入
import os
import sys
from importlib.machinery import SourceFileLoader
sys.path.append(r"Z:\hi1\hi2\my_folder")
base_update = SourceFileLoader("extract", r"Z:\hi1\hi2\my_folder\Soft_python\extract.py").load_module()
在我的 extract.py
中导入
import parseFunction as scan_rfid
在我的 parseFunction 中导入:
import xml.etree.ElementTree as open_xml
from openpyxl import Workbook
from openpyxl import load_workbook
执行.exe时,returns出现以下错误:
import parseFunction as scan_rfid
File "Z:\hi1\hi2\my_folder\Soft_python\parseFunction.py", line 1, in '<'module'>'
import xml.etree.ElementTree as open_xml
ImportError: No module named 'xml.etree'
使用 PyCharm 和我的虚拟环境执行 fileslook.py 时,我的软件运行正常。
在我的 python 安装中寻找 un etree.py 文件时,我发现的唯一东西是:
etree.py 位置:
请帮忙。
xml.etree.ElementTree is part of Standard Library. Try to specify hidden imports when compile to exe with PyInstaller
- either as CLI argument or in the spec file. Read Listing Hidden Imports section here
如其所说:
Hidden imports can also occur when an extension module uses the Python/C API to do an import
我认为这就是您导入方式的问题 extract.py
我正在使用命令:pyinstaller --onefile fileslook.py
这是我的 fileslook.py
的导入import os
import sys
from importlib.machinery import SourceFileLoader
sys.path.append(r"Z:\hi1\hi2\my_folder")
base_update = SourceFileLoader("extract", r"Z:\hi1\hi2\my_folder\Soft_python\extract.py").load_module()
在我的 extract.py
中导入import parseFunction as scan_rfid
在我的 parseFunction 中导入:
import xml.etree.ElementTree as open_xml
from openpyxl import Workbook
from openpyxl import load_workbook
执行.exe时,returns出现以下错误:
import parseFunction as scan_rfid
File "Z:\hi1\hi2\my_folder\Soft_python\parseFunction.py", line 1, in '<'module'>' import xml.etree.ElementTree as open_xml
ImportError: No module named 'xml.etree'
使用 PyCharm 和我的虚拟环境执行 fileslook.py 时,我的软件运行正常。
在我的 python 安装中寻找 un etree.py 文件时,我发现的唯一东西是:
etree.py 位置:
请帮忙。
xml.etree.ElementTree is part of Standard Library. Try to specify hidden imports when compile to exe with PyInstaller
- either as CLI argument or in the spec file. Read Listing Hidden Imports section here
如其所说:
Hidden imports can also occur when an extension module uses the Python/C API to do an import
我认为这就是您导入方式的问题 extract.py