Skip to main content
 首页 » 编程设计

python之关于从 SimpleCV 导入 Shell 的 ShimWarning

2025年05月04日16thcjp

当我从 SimpleCV 导入 Shell 时

from SimpleCV import Shell

我收到这个错误

C:\Python27\lib\site-packages\IPython\config.py:13: ShimWarning: The IPython.config package has been deprecated. You should import from traitlets.config instead. "You should import from traitlets.config instead.", ShimWarning)

C:\Python27\lib\site-packages\IPython\frontend.py:21: ShimWarning: The top->level frontend package has been deprecated. All its subpackages have been >moved to the top IPython level. "All its subpackages have been moved to the top IPython level.", >ShimWarning)

虽然在调用

Shell.main()

SimpleCV 控制台确实启动了,但是当我关闭 img.show() 的窗口时,它只是退出了整个 python 控制台,而不仅仅是 SimpleCV 控制台

不知道发生了什么!

请您参考如下方法:

一些 SimpleCV 代码需要更新——我相信它是为比安装的版本更旧的版本编写的。这是您需要做的:

找到 Shell.py,它可能位于 C:\Python27\Lib\site-packages\SimpleCV\Shell 之类的地方,然后在编辑器中打开它。然后执行以下操作

在第 50 行附近,将 from IPython.config.loader import Config 更改为 from traitlets.config.loader import Config

在第 51 行附近,将 from IPython.frontend.terminal.embed import InteractiveShellEmbed 更改为 from IPython.terminal.embed import InteractiveShellEmbed