matplotlib
与 MacOS 一起使用的问题是一个棘手的问题,已经通过许多讨论(见下文)进行了彻底审查。问题如下:
这是我想出的最简单的代码片段,它允许重现问题:
from matplotlib import pyplot as plt
x = [1, 2, 3]
y = [1, 2, 3]
plt.plot(x, y)
plt.show()
Run Code Online (Sandbox Code Playgroud)
这会引发以下错误:
2019-03-22 12:25:43.429 python3.7[22209:554135] -[NSApplication _setup:]: unrecognized selector sent to instance 0x7f85866b9de0
2019-03-22 12:25:43.431 python3.7[22209:554135] \*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSApplication _setup:]: unrecognized selector sent to instance 0x7f85866b9de0'
*** First throw call stack:([...])
libc++abi.dylib: terminating with uncaught exception of type …
Run Code Online (Sandbox Code Playgroud)