[英]ImportError: attempted relative import with no known parent package?
Command:命令:
python3 main.py file.dump python3 main.py file.dump
I get an error stating that:我收到一条错误消息,指出:
File "main.py", line 3, in文件“main.py”,第 3 行,在
from .Histogram import Histogram
ImportError: attempted relative import with no known parent package导入错误:尝试在没有已知父包的情况下进行相对导入
I do not know where i am going wrong.我不知道我哪里出错了。 I am in the same directory where the dump file, the Histogram.py file and the main.py file are placed.
我在放置转储文件、Histogram.py 文件和 main.py 文件的同一目录中。
For the .py files click on the link below:对于 .py 文件,请单击以下链接:
https://github.com/riscv-newop/riscv-newop/tree/master/rvnewop https://github.com/riscv-newop/riscv-newop/tree/master/rvnewop
I am clueless.我一窍不通。 Where am I going wrong?
我哪里错了?
Why is the Histogram file not getting imported ?为什么未导入直方图文件?
since Histogram.py is in same folder as the main.py, You can simply write由于 Histogram.py 与 main.py 位于同一文件夹中,您可以简单地编写
from Histogram import Histogram
obj = Histogram()
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.