gpt4 book ai didi

python - pyinstaller 3.3.1 不适用于 openpyxl 2.4.1

转载 作者:行者123 更新时间:2023-12-01 08:57:05 25 4
gpt4 key购买 nike

我有一个大型程序,正在尝试使用 pyinstaller 打包,并发现问题出在 openpyxl 包上。

这是一个最小的程序:

import openpyxl
print("Hello World")

这是我用来运行 pyinstaller 的命令:

$ pyinstaller --onefile demo2.py

这是输出:

$ pyinstaller --onefile demo2.py
461 INFO: PyInstaller: 3.3.1
461 INFO: Python: 3.6.0
470 INFO: Platform: Darwin-18.0.0-x86_64-i386-64bit
471 INFO: wrote /Users/user/gits/drb_rounder/python/demo2.spec
475 INFO: UPX is not available.
476 INFO: Extending PYTHONPATH with paths
['/Users/user/gits/drb_rounder/python',
'/Users/user/gits/drb_rounder/python']
476 INFO: checking Analysis
579 INFO: Building because /Users/user/gits/drb_rounder/python/demo2.py changed
579 INFO: Initializing module dependency graph...
585 INFO: Initializing module graph hooks...
587 INFO: Analyzing base_library.zip ...
4887 INFO: running Analysis out00-Analysis.toc
4898 INFO: Caching module hooks...
4902 INFO: Analyzing /Users/user/gits/drb_rounder/python/demo2.py
6692 INFO: Processing pre-find module path hook distutils
10268 INFO: Processing pre-find module path hook site
10269 INFO: site: retargeting to fake-dir '/Users/user/anaconda3/lib/python3.6/site-packages/PyInstaller/fake-modules'
10296 INFO: Processing pre-safe import module hook win32com
12225 INFO: Processing pre-safe import module hook six.moves
23816 INFO: Processing pre-safe import module hook

requests.packages.urllib3.packages.six.moves
Traceback (most recent call last):
File "/Users/user/anaconda3/bin/pyinstaller", line 11, in <module>
sys.exit(run())
File "/Users/user/anaconda3/lib/python3.6/site-packages/PyInstaller/__main__.py", line 94, in run
run_build(pyi_config, spec_file, **vars(args))
...
packages/PyInstaller/lib/modulegraph/modulegraph.py", line 1576, in _find_head_package
target_module_headname, target_package_name, source_package)
File "/Users/user/anaconda3/lib/python3.6/site-packages/PyInstaller/depend/analysis.py", line 271, in _safe_import_module
module_basename, module_name, parent_package)
File "/Users/user/anaconda3/lib/python3.6/site-packages/PyInstaller/lib/modulegraph/modulegraph.py", line 1993, in _safe_import_module
module_name, file_handle, pathname, metadata)
File "/Users/user/anaconda3/lib/python3.6/site-packages/PyInstaller/lib/modulegraph/modulegraph.py", line 2031, in _load_module
m = self._load_package(fqname, pathname, packagepath)
File "/Users/user/anaconda3/lib/python3.6/site-packages/PyInstaller/lib/modulegraph/modulegraph.py", line 2789, in _load_package
ns_pkgpath = _namespace_package_path(fqname, pkgpath or [], self.path)
File "/Users/user/anaconda3/lib/python3.6/site-packages/PyInstaller/lib/modulegraph/modulegraph.py", line 147, in _namespace_package_path
working_set = pkg_resources.WorkingSet(path)
File "/Users/user/anaconda3/lib/python3.6/site-packages/setuptools-27.2.0-py3.6.egg/pkg_resources/__init__.py", line 644, in __init__
File "/Users/user/anaconda3/lib/python3.6/site-packages/setuptools-27.2.0-py3.6.egg/pkg_resources/__init__.py", line 700, in add_entry
File "/Users/user/anaconda3/lib/python3.6/site-packages/setuptools-27.2.0-py3.6.egg/pkg_resources/__init__.py", line 1990, in find_on_path
File "/Users/user/anaconda3/lib/python3.6/site-packages/setuptools-27.2.0-py3.6.egg/pkg_resources/__init__.py", line 2399, in from_location
File "/Users/user/anaconda3/lib/python3.6/site-packages/setuptools-27.2.0-py3.6.egg/pkg_resources/__init__.py", line 2378, in __init__
File "/Users/user/anaconda3/lib/python3.6/site-packages/setuptools-27.2.0-py3.6.egg/pkg_resources/__init__.py", line 1387, in safe_version
File "/Users/user/anaconda3/lib/python3.6/site-packages/setuptools-27.2.0-py3.6.egg/pkg_resources/_vendor/packaging/version.py", line 207, in __init__
File "/Users/user/anaconda3/lib/python3.6/site-packages/setuptools-27.2.0-py3.6.egg/pkg_resources/_vendor/packaging/version.py", line 207, in <genexpr>
RecursionError: maximum recursion depth exceeded while calling a Python object
$

最佳答案

在我看来,openpyxl 不喜欢它被编译:当编译与您相同的代码时,我得到:

json.decoder.JSONDecodeError:期望值:第 1 行第 1 列(字符 0)

但是,还有其他用于读取 Excel 文件的模块,例如 pyexcel (虽然还没有尝试过)

关于python - pyinstaller 3.3.1 不适用于 openpyxl 2.4.1,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52724954/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com