python - 由于未处理的异常而无法执行脚本:选择默认后端“matplotlib”时需要使用matplotlib进行绘图
问题描述
我有一个.py
显示历史股票曲线以在不同股票之间进行比较的程序,在 PyCharm 中运行它是毫无疑问的,但是当将其转换.py
为.exe
文件或当此转换命中语句时df.plot
,错误显示如下:
Failed to execute script ‘my_python_file’ due to unhandled exception: matplotlib is required for plotting when the default backend “matplotlib” is selected.
同样的转换方法适用于我的另一个.py
显示计算器 GUI 的程序,运行它的文件没有任何问题exe
,但不适用于这个显示股票曲线的程序。试pip install
了好几个包,还是不行!期待高手的意见!
解决方案
hello furas,
There are two steps to do the converting:
1. pip install pysimplegui-exemaker
2. python -m pysimplegui-exemaker.pysimplegui-exemaker
After the two steps, a GUI pops up where you can select the .py to make .exe.
and the traces:
Traceback (most recent call last):
File "matplotlibDrawing.py", line 130, in <module>
tsla_ningde.plot(kind='line',figsize=(8,5))
File "pandas\plotting\_core.py", line 892, in __call__
File "pandas\plotting\_core.py", line 1814, in _get_plot_backend
File "pandas\plotting\_core.py", line 1754, in _load_backend
ImportError: matplotlib is required for plotting when the default backend "matplotlib" is selected.
推荐阅读
- database - 如何在 Sqlite Flutter 中列出数据库中的所有表?
- mysql - MySQL 联合和重复
- java - 从类创建新对象时出现“找不到符号”错误?
- google-apps-script - 如何在宏中使用 getRange 中的变量,将行范围复制到另一个具有可变目标的 Google 工作表
- regex - 有没有办法仅在模式匹配时使用带有 awk 的正则表达式来执行命令?
- arrays - 动态数组的概率随机选择
- python - Python tkinter:可能具有可变行高的表?
- android - 运行应用程序时出现键盘布局边缘?
- fiware-orion - 固件猎户座:按环境配置
- intellij-idea - 仅在 Intellj 的特定模块中查找符号的用法