pythonleelee 发表于 2022-7-4 15:13:40

下了pycharm发现程序都跑不了了为啥

本帖最后由 pythonleelee 于 2022-7-4 15:41 编辑

全是这种错误
Traceback (most recent call last):
File "D:/python/try/mat.py", line 6, in <module>
    pyplot.plot(x,y)
File "D:\python\try\venv\lib\site-packages\matplotlib\pyplot.py", line 2769, in plot
    return gca().plot(
File "D:\python\try\venv\lib\site-packages\matplotlib\pyplot.py", line 2274, in gca
    return gcf().gca(**kwargs)
File "D:\python\try\venv\lib\site-packages\matplotlib\pyplot.py", line 867, in gcf
    return figure()
File "D:\python\try\venv\lib\site-packages\matplotlib\pyplot.py", line 811, in figure
    FigureClass=FigureClass, **kwargs)
File "D:\python\try\venv\lib\site-packages\matplotlib\pyplot.py", line 326, in new_figure_manager
    _warn_if_gui_out_of_main_thread()
File "D:\python\try\venv\lib\site-packages\matplotlib\pyplot.py", line 316, in _warn_if_gui_out_of_main_thread
    if (_get_required_interactive_framework(_get_backend_mod())
File "D:\python\try\venv\lib\site-packages\matplotlib\pyplot.py", line 217, in _get_backend_mod
    switch_backend(dict.__getitem__(rcParams, "backend"))
File "D:\python\try\venv\lib\site-packages\matplotlib\pyplot.py", line 268, in switch_backend
    switch_backend(candidate)
File "D:\python\try\venv\lib\site-packages\matplotlib\pyplot.py", line 288, in switch_backend
    class backend_mod(matplotlib.backend_bases._Backend):
File "D:\python\try\venv\lib\site-packages\matplotlib\pyplot.py", line 289, in backend_mod
    locals().update(vars(importlib.import_module(backend_name)))
File "D:\python\lib\importlib\__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name, package, level)
File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
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 "<frozen importlib._bootstrap_external>", line 728, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "D:\python\try\venv\lib\site-packages\matplotlib\backends\backend_tkagg.py", line 1, in <module>
    from . import _backend_tk
File "D:\python\try\venv\lib\site-packages\matplotlib\backends\_backend_tk.py", line 7, in <module>
    import tkinter as tk
File "D:\python\try\tkinter.py", line 3, in <module>
    app = tk.Tk()
AttributeError: module 'tkinter' has no attribute 'Tk'

Process finished with exit code 1

z5560636 发表于 2022-7-4 16:33:58

包的导入有问题,你确定不是你自己的问题?

Twilight6 发表于 2022-7-4 18:08:25



基础的问题,模块没有导入,建议基础先或多或少学习点

页: [1]
查看完整版本: 下了pycharm发现程序都跑不了了为啥