无法导入mkdtemp

时间:2019-03-09 12:20:52

标签: python matplotlib

这一直都很好,但是最近当我尝试导入matplotlib.pyplot时,我一直收到此错误,我尝试重新安装所有内容并检查了整个Web,但我无法弄清楚。

这是我得到的错误:

> >  File "random.py", line 2, in <module>
>     import matplotlib.pyplot as plt   File "C:\Users\Sluiter\Anaconda3\lib\site-packages\matplotlib\__init__.py",
> line 121, in <module>
>     import tempfile   File "C:\Users\Sluiter\Anaconda3\lib\tempfile.py", line 45, in <module>
>     from random import Random as _Random   File "C:\Users\Sluiter\Desktop\python\random.py", line 2, in <module>
>     import matplotlib.pyplot as plt   File "C:\Users\Sluiter\Anaconda3\lib\site-packages\matplotlib\pyplot.py",
> line 31, in <module>
>     import matplotlib.colorbar   File "C:\Users\Sluiter\Anaconda3\lib\site-packages\matplotlib\colorbar.py",
> line 29, in <module>
>     import numpy as np   File "C:\Users\Sluiter\Anaconda3\lib\site-packages\numpy\__init__.py", line
> 142, in <module>
>     from . import add_newdocs   File "C:\Users\Sluiter\Anaconda3\lib\site-packages\numpy\add_newdocs.py",
> line 13, in <module>
>     from numpy.lib import add_newdoc   File "C:\Users\Sluiter\Anaconda3\lib\site-packages\numpy\lib\__init__.py",
> line 8, in <module>
>     from .type_check import *   File "C:\Users\Sluiter\Anaconda3\lib\site-packages\numpy\lib\type_check.py",
> line 11, in <module>
>     import numpy.core.numeric as _nx   File "C:\Users\Sluiter\Anaconda3\lib\site-packages\numpy\core\__init__.py",
> line 103, in <module>
>     from numpy.testing._private.pytesttester import PytestTester   File
> "C:\Users\Sluiter\Anaconda3\lib\site-packages\numpy\testing\__init__.py",
> line 12, in <module>
>     from ._private.utils import *   File "C:\Users\Sluiter\Anaconda3\lib\site-packages\numpy\testing\_private\utils.py",
> line 16, in <module>
>     from tempfile import mkdtemp, mkstemp ImportError: cannot import name 'mkdtemp' from 'tempfile'
> (C:\Users\Sluiter\Anaconda3\lib\tempfile.py)

如果有人知道如何解决它,我将不胜感激,我需要在学校作业中修复它,我想绘制一些直方图,但现在无法绘制。

0 个答案:

没有答案