PyEval_RestoreThread:plot.show()上的NULL tstate

时间:2018-08-21 09:35:52

标签: python matplotlib

import sys
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D

def plot(simulation, thresholds, simtime):
   fig1, (ax1, ax2, ax3) = plt.subplots(3, 1, sharex=True)

   fig1.set_size_inches(8, 6, forward=True)
   fig1.show()

我尝试使用此简单代码来在phyton中打开一个图。但是,每次执行程序时,都会出现以下错误:Fatal Python error: PyEval_RestoreThread: NULL tstate。我的Phyton版本是3.7.0。我使用以下命令安装了matplotlib:pip install matplotlib

我的整个追溯:

Fatal Python error: PyEval_RestoreThread: NULL tstate

Thread 0x000036e8 (most recent call first):
File "c:\Users\noname\.vscode\extensions\ms-python.python-2018.7.1\pythonFiles\PythonTools\visualstudio_py_util.py", line 137 in read_bytes
File "c:\Users\noname\.vscode\extensions\ms-python.python-2018.7.1\pythonFiles\PythonTools\visualstudio_py_debugger.py", line 1726 in loop

Current thread 0x00003a1c (most recent call first):
File "c:\Users\noname\Desktop\Software\source\core.py", line 242 in main
File "c:\Users\noname\Desktop\Software\source\core.py", line 245 in <module>
File "c:\Users\noname\.vscode\extensions\ms-python.python-2018.7.1\pythonFiles\PythonTools\visualstudio_py_util.py", line 95 in exec_code
File "c:\Users\noname\.vscode\extensions\ms-python.python-2018.7.1\pythonFiles\PythonTools\visualstudio_py_util.py", line 119 in exec_file
File "c:\Users\noname\.vscode\extensions\ms-python.python-2018.7.1\pythonFiles\PythonTools\visualstudio_py_debugger.py", line 2625 in debug
File "c:\Users\noname\.vscode\extensions\ms-python.python-2018.7.1\pythonFiles\PythonTools\visualstudio_py_launcher.py", line 91 in <module>

0 个答案:

没有答案