|
|
1
4
它是
我设法复制了它。 目录结构如下: cesar@cesar-laptop:/tmp/asdasd$ tree
.
`-- myapp
|-- __init__.py
|-- models
| |-- __init__.py
| `-- models.py
|-- scripts
| |-- data.py
| `-- __init__.py
`-- tests
|-- __init__.py
`-- tests.py
运行
cesar@cesar-laptop:/tmp/asdasd$ python myapp/scripts/data.py
['/tmp/asdasd/myapp/scripts',
'/usr/lib/python2.6',
'/usr/lib/python2.6/plat-linux2',
'/usr/lib/python2.6/lib-tk',
-- Skipped --
'/usr/local/lib/python2.6/dist-packages']
Traceback (most recent call last):
File "myapp/scripts/data.py", line 6, in
from myapp.models.models import *
ImportError: No module named myapp.models.models
但这种方式很有魅力: cesar@cesar-laptop:/tmp/asdasd$ python -m myapp.scripts.data ['', '/usr/lib/python2.6', '/usr/lib/python2.6/plat-linux2', '/usr/lib/python2.6/lib-tk', -- Skipped -- '/usr/local/lib/python2.6/dist-packages']
注意第一个条目中的差异
|
|
|
2
1
你执行得怎么样
这个
如果包含
|
|
|
3
1
你的
在两个模块的顶部确认。然后,修复一个错误(通过附加到
|
|
|
4
0
除非你忘了提,否则你就没有机会了
除非
|
|
|
PS_dev · 在目标C项目的静态库中获取框架头文件未找到错误 8 年前 |
|
|
B Furtado · Windows中还有一个GDAL导入错误 8 年前 |
|
|
lbear · python中的绝对导入不起作用,相对导入起作用 9 年前 |
|
|
NI6 · Git子模块在python项目中使用后引发导入错误 9 年前 |
|
|
Andr · 导入问题python[PILLOW][副本] 10 年前 |
|
|
Lothar · python ImportError,没有导入调用 11 年前 |