python - NameError : name 'defaultParams' is not defined while running the . exe 使用 Pyinstaller 转换

标签 python python-3.x matplotlib pyinstaller

我成功转换了 main.py使用 pyinstaller 的脚本。但是,在执行 .exe 时会抛出以下错误。文件相同。

MatplotlibDeprecationWarning: Matplotlib installs where the data is not in the mpl-data subdirectory of the package are deprecated since 3.2 and support for them will be removed two minor releases later.
  exec(bytecode, module.__dict__)
Traceback (most recent call last):
  File "main.py", line 8, in <module>
  File "<frozen importlib._bootstrap>", line 983, in _find_and_load
  File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
  File "c:\users\XXXX\appdata\local\programs\python\python37\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 493, in exec_module
    exec(bytecode, module.__dict__)
  File "matplotlib\__init__.py", line 898, in <module>
  File "matplotlib\cbook\__init__.py", line 480, in _get_data_path
  File "matplotlib\__init__.py", line 239, in wrapper
  File "matplotlib\__init__.py", line 534, in get_data_path
  File "matplotlib\__init__.py", line 239, in wrapper
  File "matplotlib\__init__.py", line 563, in _get_data_path
NameError: name 'defaultParams' is not defined

最佳答案

据说,您可以做的就是将您的 matplotlib 降级到以下版本:pip install matplotlib==3.2.2显然,最新版本的 matplotlib 干扰了 Windows 路径中的环境变量。

关于python - NameError : name 'defaultParams' is not defined while running the . exe 使用 Pyinstaller 转换,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63503976/

相关文章:

python - Django Autocomplete Light 限制查询结果

python-3.x - Numpy 安装损坏的工具链 : cannot link a simple C program

python-3.x - 无法将我的 Pandas 数据框导出到 excel

python - 格式化 SQL 查询

python - PIL 图像和 matplotlib 图为 png 图像获取饱和黑白

matplotlib - 如何根据从 Twitter API 收集的数据生成网络矩阵?

python - 将级别值存储在等值线图中

python - 无法通过python登录网站

python - 自动将照片上传到特定的 Google 相册相册

python - 无法从另一个文件导入函数