英文:
Getting an Import Error when importing 'Model' from 'age.models'
问题
我在尝试从文件 'age.models' 中导入 'Model' 时遇到了这个导入错误,错误详情如下:
- 我的版本是 3.9,我在 Windows 10 上
- 用 Pip 命令安装驱动程序
- 当我尝试导入时,我收到了以下错误消息:
ImportError: 无法从 'age.models' 导入名称 'Model'
(c:\Users\lenovo\age\drivers\python\age\models.py)
大家有什么建议?
英文:
I am facing this error of import when I am trying to import 'Model' from the file 'age.models',here are the details:
- My Version is 3.9 and I'm on windows 10
- Pip command is used for installing the drivers.
- I got this error message when I tried to import:
> ImportError: cannot import name 'Model' from 'age.models'
> (c:\Users\lenovo\age\drivers\python\age\models.py)
What do you all suggest?
答案1
得分: 1
When looking at the models.py
file, the class Model
is not defined. It includes Graph, AGObj, Path, Vertex, and Edge classes. To determine the required imports for your application, please review the model.py
file.
英文:
When looking at the models.py
file, the class Model
is not defined. It includes Graph, AGObj, Path, Vertex, and Edge classes. To determine the required imports for your application, please review the model.py
file.
答案2
得分: 1
从GitHub上检查model.py文件:models.py,您还可以尝试导入您想要使用的特定类。
from age.models import Graph
英文:
Check the model.py file from the github: models.py you can also check this issue by trying to import the specific class you want to use.
from age.models import Graph
答案3
得分: 1
Model
对象您试图导入的在您引用的models.py
文件中未定义。也许您想要导入所有对象,可以使用:
from age.models import *
英文:
The Model
object that you are trying to import is not defined in the file models.py
that you are referencing. Perhaps you would like to import all objects using:
from age.models import *
答案4
得分: 1
如果您正在寻找Python驱动程序的models.py文件中的Model类或Function,您不会在那里找到它。但是,您应该使用以下导入语句:
import age.models as model
或者
from age.models import *
英文:
If you're looking for the Model class or Function in the Python driver's models.py file, you won't find it there. However, you should use the import statement as follows:
import age.models as model
OR
from age.models import *
答案5
得分: 1
看起来 ImportError 是由尝试导入 age.models
模块中不存在的 'Model' 类引起的。
如果你查看 Apache AGE Python 驱动的 GitHub 页面 上的 age.models
的内容,你会看到 'Model' 在该模块中并没有被声明为一个类,这就是你遇到这个错误的原因。
请确保你导入的是在 age.models
模块中实际存在的类或函数。你可以用以下语句从 age.models
导入所有类:
from age.models import *
英文:
It appears that the ImportError is caused by trying to import a 'Model' class that doesn't exist in the age.models
module.
If you check the content of age.models
on the Apache AGE Python driver GitHub page, you will see that 'Model' is not a declared class in that module, which is why you're encountering this error.
Please make sure you are importing a class or function that actually exists in the age.models
module. You can import all classes from age.models
with the following statement:
from age.models import *
答案6
得分: -1
您遇到的错误是因为在导入Model类时出现了问题,该类位于age.models模块中,位于您的计算机上的以下位置:
c:\Users\lenovo\age\drivers\python\age\models.py
请确保models.py文件包含对Model类的定义。有可能文件本身存在拼写错误或其他问题。
英文:
The error you are experiencing is because of the issue in importing the Model class from age.models module, which is located in
> c:\Users\lenovo\age\drivers\python\age\models.py
in your machine.
Make sure the models.py file contains a definition for the Model class. It's possible that the file itself has a typo or another problem.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论