简体   繁体   English

在 jupyter notebook 中无法识别 pythonnet clr

[英]pythonnet clr is not recognized in jupyter notebook

I have installed pythonnet to use clr package for a specific API, which only works with clr in python.我已经安装了 pythonnet 来使用特定 API 的 clr 包,它只适用于 python 中的 clr。 Although in my python script (using command or regular .py files) it works without any issues, in jupyter notebook, import clr gives this error, ModuleNotFoundError: No module named 'clr' .尽管在我的 python 脚本(使用命令或常规 .py 文件)中它没有任何问题,但在 jupyter notebook 中, import clr给出了这个错误, ModuleNotFoundError: No module named 'clr' Any idea how to address this issue?知道如何解决这个问题吗?

Here is simple suggestion: compare sys.path in both cases and see the differences.这是一个简单的建议:比较这两种情况下的sys.path并查看差异。 Your ipython kernel in jupyter is probably searching in different directories than in normal python process.您在 jupyter 中的 ipython 内核可能在与普通 python 进程不同的目录中搜索。

由于您打算在 jupyter 中使用 clr,因此在 jupyter 单元中,您也可以!pip install pythonnet第一次和以后每次如果 vm 经常被 nuked

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

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