简体   繁体   English

在OSX中导入matplotlib时出现NSException

[英]NSException on import of matplotlib, kivy in OSX

I'm working on some kivy code that's working fine on windows 10, but crashes on osx sierra, I've isolated that the crash happens when I import kivy.core.window along side matplotlib: 我正在处理一些在Windows 10上可以正常运行的kivy代码,但是在osx sierra上崩溃,我隔离出了当我沿着matplotlib侧面导入kivy.core.window时发生崩溃的情况:

import matplotlib
matplotlib.use("TkAgg")
from matplotlib import pyplot as plt
import kivy.core.window

It also crashes without matplotlib.use("TkAgg") . 没有matplotlib.use("TkAgg")也会崩溃。 This is just included to show that the issue isn`t fixed by this as other questions suggest. 只是为了说明此问题并未像其他问题所建议的那样解决此问题。

The output from the exception is: 异常的输出为:

2017-03-08 13:33:32.461 Python[28614:209475] -[SDLApplication _setup:]: unrecognized selector sent to instance 0x1020ea6c0
2017-03-08 13:33:32.464 Python[28614:209475] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[SDLApplication _setup:]: unrecognized selector sent to instance 0x1020ea6c0'
*** First throw call stack:
(
0   CoreFoundation  0x00007fffa8716e7b  __exceptionPreprocess + 171
1   libobjc.A.dylib                     0x00007fffbd300cad objc_exception_throw + 48
...
)
libc++abi.dylib: terminating with uncaught exception of type NSException

What could be causing this, and where do I start looking to debug this type of exception it? 可能是什么原因导致的?我应该从哪里开始调试这种类型的异常呢?

After solving this I ran into a perhaps related problem, noted in this question . 解决此问题后,我遇到了一个可能与此问题相关的问题。

I managed to solved this problem through running 我设法通过运行解决了这个问题

pip install kivy-gardens
garden install matplotlib

I'm not sure why this worked, but it did remove this root of the NSException. 我不确定为什么这样做,但是确实删除了NSException的这个根。

I'm now getting a different NSException caused by a different interplay of dependencies that I'll post as a new question . 我现在由于依赖关系的不同相互作用而引起了一个NSException,我将作为新问题发表

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM