我编写了一个 Python 3.6 程序,它读取 UTM 坐标的 .txt 文件,将它们按逆时针顺序排序,使用 matplotlib 在图形上显示坐标,然后将坐标写入桌面上的 .txt 文件。当我在spyder(我一直在使用的IDE)中运行它时它工作正常,但是当我使用cx_Freeze(通过构建我的python文件)将其转换为exe并尝试运行它时,我收到以下错误:ModuleNotFoundError :没有名为“matplotlib.backends.backend_qt5agg”的模块我尝试通过执行以下操作来安装 Qt5 后端: pip install PyQt5 以及更新 cx_Freeze。任何帮助将非常感激。我仍然是 Python 以及一般编程的初学者,所以如果我的解释不够清楚,我深表歉意。下面是我的主要 Python 脚本的代码
import matplotlib
matplotlib.use('Qt5Agg')
import matplotlib.pyplot as plt
import math as math
import tkinter as tk
from tkinter.filedialog import askopenfilename
import time
def findFilename():
root = tk.Tk()
#root.withdraw()
filename = askopenfilename()
root.destroy()
return(filename)
def findSize(cnt, filename):
#number of lines in file
with open(filename) as f:
for line in f:
cnt = cnt+1;
return cnt;
def findChar(filename):
file …Run Code Online (Sandbox Code Playgroud) 我最近切换到 Spyder 作为我的 IDE。到目前为止,它一直很棒,但我一直遇到一个反复出现的问题。
使用 Spyder 一段时间后,它随机冻结,我被迫通过任务管理器关闭它。
当我尝试打开文件、保存文件、更改首选项以及查看代码分析错误时,它会冻结。
我不知道如何解决这个问题,因为没有错误消息,我也没有在网上其他地方找到太多帮助。
我尝试卸载并重新安装 Spyder 和 Anaconda 以及使用旧版本的 Spyder,但没有任何效果。我的操作系统是 Windows 10。