ImportError:无法导入名称游戏

时间:2018-11-23 01:05:21

标签: python-2.7

我遇到错误-ImportError:无法导入名称

Traceback (most recent call last): File "/Library/Python/2.7/site-packages/nose-1.3.7-py2.7.egg/nose/loader.py", line 418, in loadTestsFromName addr.filename, addr.module) File "/Library/Python/2.7/site-packages/nose-1.3.7-py2.7.egg/nose/importer.py", line 47, in importFromPath return self.importFromDir(dir_path, fqname) File "/Library/Python/2.7/site-packages/nose-1.3.7-py2.7.egg/nose/importer.py", line 94, in importFromDir mod = load_module(part_fqname, fh, filename, desc) File "/Users/rng/PycharmProjects/ex47/tests/ex47_tests.py", line 2, in <module> from ex47 import game ImportError: cannot import name game

这是我的目录结构供参考: 在该文件夹中,我有两个文件夹和两个python文件: ./ex47
./tests
初始化 .py
setup.py

./ ex47:
game.py
初始化 .py

./测试:
ex47_tests.py
初始化 .py

ex47_tests.py看起来像这样:
从鼻子。工具进口*
来自ex47导入游戏

我已阅读并尝试了导出PYTHONPATH =。在上面的目录上无济于事。有想法吗?

0 个答案:

没有答案