我试图从一本书中测试一个例子,得到一个ImportError
。在
这个例子的开头是:
from tkinter import *
from PP4E.Gui.Tools.widgets import frame, button, entry
如果我在代码的开头加一个import sys; print(sys.path)
,那么输出是
以下是我的programming-python
目录的截断版本:
❯ tree
.
├── PP4E
│ ├── __init__.py
│ ├── Gui
│ │ ├── Tools
│ │ │ ├── __init__.py
│ │ │ └── widgets.py
│ │ └── __init__.py
│ ├── Lang
│ │ └── Calculator
│ │ ├── __init__.py
│ │ └── calc0.py
└── site-packages
└── PP4E.pth
我收到的错误消息是:
❯ python3 calc0.py
Traceback (most recent call last):
File "calc0.py", line 2, in <module>
from PP4E.Gui.Tools.widgets import frame, button, entry
ImportError: No module named 'PP4E'
有人知道我要怎么做才能让Python找到PP4E模块吗?谢谢。在
我的}。谢谢。在
PYTHONPATH
错了根目录是/Users
,不是{相关问题 更多 >
编程相关推荐