导入Eve,但在运行run.py时,显示没有名为Eve的模块



我最近开始关注Eve。

我已经阅读了Eve安装指南并成功导入。

然后,我尝试了快速入门指南,并对settings.py做了一些更改。当我尝试运行run.py时,它给了我这个错误:

Traceback (most recent call last):   File "run.py", line 1, in
<module>     from eve import Eve ImportError: No module named eve
这是我的run.py代码:
from eve import Eve
app = Eve()
if __name__ == '__main__':
    app.run()

这是settings。py

的代码
MONGO_HOST = 'localhost'
MONGO_PORT = 27017
MONGO_DBNAME = 'clownsighting'
RESOURCE_METHODS = ['GET', 'POST', 'DELETE']
ITEM_METHODS = ['GET', 'PATCH', 'PUT', 'DELETE']
schema = {
    'scarinesslevel' : {'type' : 'string'},
    'date' : {'type' : 'date'},
    'address' : { 'type' : 'string' },
    'city' : {'type' : 'string'},
    'state' : {'type' : 'string'},
    'country' : {'type' : 'string'},
    'continent' : {'type' : 'string'}
}
sightings = {
    'additional_lookup' : {
        'url' : 'regex("[w]+")',
        'field' : 'date'
        },
    'schema' : schema
}
DOMAIN = {'sightings': sightings,}

这两个文件在同一个目录下,如果有帮助的话

看起来Eve没有安装(或者您没有在正确的虚拟环境中)。pip freeze将告诉您当前安装了哪些模块。如果Eve未列出,请尝试pip install eve

我明白了。我没有运行

命令
python run.py

在虚拟环境中。

最新更新