jupyter notebook中报错 未定义名称“_C”
时间: 2023-05-29 14:04:19 浏览: 271
这个错误通常是因为您没有正确导入必要的Python模块或库。请检查您的代码,确保您已正确导入所有需要的模块和库。
如果您使用了PyTorch库,那么您可能需要添加以下导入语句:
```
import torch
from torch import _C
```
如果您仍然遇到问题,请提供更多详细信息以便我们更好地帮助您解决问题。
相关问题
Jupyter notebook中sqrt 未定义怎么解决
在Jupyter Notebook中,如果你使用sqrt函数时出现未定义的情况,可能是因为你没有正确导入math模块。sqrt函数属于math模块中的一个函数,需要先导入math模块才能使用。
你可以通过以下步骤解决这个问题:
1. 在代码的开头或者使用sqrt函数之前,添加以下导入语句:
```python
import math
```
2. 然后就可以使用math模块中的sqrt函数了,例如:
```python
result = math.sqrt(16)
print(result)
```
这样就可以计算出16的平方根并打印出结果。
jupyter notebook变量未定义
这个问题可能是因为您在使用变量之前没有定义它。请确保您已经定义了所需的变量,或者在使用变量之前先进行定义。如果您已经定义了变量,但仍然出现此错误,请检查变量名称是否正确拼写,并确保您正在使用正确的变量名称。
如果您正在使用Jupyter Notebook,还可以尝试重新启动内核并重新运行代码以解决此问题。
阅读全文
相关推荐















