Python - 无法导入名称 Eve

标签 python python-3.x pip eve

我正在尝试设置 Python-Eve。

Python-Eve Installation Guide

我已完成以下步骤:

C:\Users\Ari\Desktop\rizzla>python -m pip install eve
Requirement already satisfied (use --upgrade to upgrade): eve in c:\python34\lib
\site-packages
Requirement already satisfied (use --upgrade to upgrade): cerberus<0.9,>=0.8 in
c:\python34\lib\site-packages (from eve)
Requirement already satisfied (use --upgrade to upgrade): events<0.3,>=0.2.1   in
c:\python34\lib\site-packages (from eve)
Requirement already satisfied (use --upgrade to upgrade):   simplejson<4.0,>=3.3.0
 in c:\python34\lib\site-packages (from eve)
Requirement already satisfied (use --upgrade to upgrade):   werkzeug<0.10,>=0.9.4
in c:\python34\lib\site-packages (from eve)
Requirement already satisfied (use --upgrade to upgrade):     markupsafe<1.0,>=0.23
in c:\python34\lib\site-packages (from eve)
Requirement already satisfied (use --upgrade to upgrade): jinja2<3.0,>=2.7.2  in
c:\python34\lib\site-packages (from eve)
Requirement already satisfied (use --upgrade to upgrade):     itsdangerous<1.0,>=0.2
2 in c:\python34\lib\site-packages (from eve)
Requirement already satisfied (use --upgrade to upgrade):   flask<0.11,>=0.10.1 in
 c:\python34\lib\site-packages (from eve)
Requirement already satisfied (use --upgrade to upgrade):  pymongo<3.0,>=2.7.1 in
 c:\python34\lib\site-packages (from eve)
Requirement already satisfied (use --upgrade to upgrade): flask- pymongo<0.4,>=0.
3.0 in c:\python34\lib\site-packages (from eve)

但是当尝试在 Quick Start Guide 上运行代码时我明白

Traceback (most recent call last):
 File "run.py", line 1, in <module>
 from eve import Eve
File "C:\Users\Ari\Desktop\rizzla\eve.py", line 1, in <module>
   from eve import Eve
 ImportError: cannot import name 'Eve'

我的代码在这里:

from eve import Eve

app = Eve()

if __name__ == '__main__':
    app.run()

最佳答案

您的脚本名称是eve;与您要导入的模块相同。将脚本名称重命名为其他名称以防止冲突。

如果目录中有eve.pyc,请将其删除。

关于Python - 无法导入名称 Eve,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28125792/

相关文章:

python-2.7 - 由于 "ImportError: No module named parse"无法安装 pip

python - Altair 并排分组条形图而不是单个图表

python - Django 解析 Post 请求数据(JsonArray)

python - 使用 Selenium Scraper 删除符号 (Python)

python - PyQt5 中的 LineEdit 框

python - 安装 python 包 Flair 时出错,关于 PyPI 中未托管的依赖包

python - virtualenv 中的 pip 找不到 ctypes

pip - 在 mac virtualenv 上安装 airflow 得到 : Could not build wheels for pandas which use PEP 517 and cannot be installed directly

python - 如何干净地写__getitem__?

python - 在 Django ORM 中, "values"和 "annotate"无法分组