画Voronoi图的时候运行示例程序报错
这是示例程序:
from scipy.spatial import Voronoi, voronoi_plot_2d
import numpy as np
import matplotlib.pyplot as plt
a = np.array([[0, 0], [1, 1], [1, 2],
[2, 0], [2, 1], [2, 2],
[2, 3], [4, 1], [2, 5]])
计算指定点的泰森多边形
vor = Voronoi(a)
print(vor.points)
绘制泰森多边形二维图像
fig = voronoi_plot_2d(vor)
plt.show()
这是报错信息:
Exception ignored in: 'scipy.spatial.qhull._Qhull.dealloc'
Traceback (most recent call last):
File "F:/文件/研究生/空间化/新建文件夹/泰森多边形.py", line 10, in
vor = Voronoi(a)
AttributeError: 'NoneType' object has no attribute 'close'
Traceback (most recent call last):
File "F:\Anaconda3\lib\site-packages\IPython\core\interactiveshell.py", line 3369, in run_code
exec(code_obj, self.user_global_ns, self.user_ns)
File "", line 1, in <cell line: 1>
runfile('F:/文件/研究生/空间化/新建文件夹/泰森多边形.py', wdir='F:/文件/研究生/空间化/新建文件夹')
File "F:\PyCharm 2022.1.3\plugins\python\helpers\pydev_pydev_bundle\pydev_umd.py", line 198, in runfile
pydev_imports.execfile(filename, global_vars, local_vars) # execute the script
File "F:\PyCharm 2022.1.3\plugins\python\helpers\pydev_pydev_imps_pydev_execfile.py", line 18, in execfile
exec(compile(contents+"\n", file, 'exec'), glob, loc)
File "F:/文件/研究生/空间化/新建文件夹/泰森多边形.py", line 10, in
vor = Voronoi(a)
File "qhull.pyx", line 2615, in scipy.spatial.qhull.Voronoi.init
File "qhull.pyx", line 271, in scipy.spatial.qhull._Qhull.init
File "messagestream.pyx", line 36, in scipy._lib.messagestream.MessageStream.init
OSError: Failed to open file b'C:\Users\\xe7\xba\xaa\xe6\x96\xb0\xe6\xad\xa6\AppData\Local\Temp\scipy-t1hr6ldt'