将C.Py添加到简单的项目结果“ ModulenotFoundError:no Module”中。
显然,不完全是新手,但也不是专家。在其他地方找不到这个问题。
这是一个使用原子创建的简单布局,它过去可以从终端工作正常,但由于模块c.py
刚刚添加了,因此不再工作。此布局确实可以用作Pycharm项目。
这种布局本质上是有缺陷的,还是假设最简单的“ Hello World”功能在理论上可以起作用?
先感谢您。
--blah
|__blah
|__a.py
|__b.py
|__c.py
#a.py
import b
import c
#do stuff
(venv)me blah $ python3
>>>import blah.a
ModuleNotFoundError: No module named 'c'
Not exactly a newbie but not an expert either, obviously. Could not find this problem elsewhere.
This is a simple layout created with Atom, and it used to work just fine from the terminal, but no more, since the module c.py
has just been added. This layout does work as a PyCharm project.
Is this layout inherently flawed, or should it work in theory, assuming the simplest possible "hello world" functionality?
Thank you in advance.
--blah
|__blah
|__a.py
|__b.py
|__c.py
#a.py
import b
import c
#do stuff
(venv)me blah $ python3
>>>import blah.a
ModuleNotFoundError: No module named 'c'
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在pycharm中,
blah.blah
被“标记为源”。搜索导致我进入这篇文章:是什么标记目录资料来源root“真的是吗?意识到Pycharm在我认为是理所当然的幕后做了一些事情,我尝试了该项目的原子版本中的以下内容:
解决了问题。
因此,我推测对原始问题的严格答案是“否”。
In PyCharm,
blah.blah
is "marked as sources root". Searching that led me to this post: What does "Mark directory as sources root" really do?Realizing that PyCharm did some things behind the scenes that I took for granted, I tried the following in the Atom version of the project:
which solved the problem.
Thus I surmise that the strict answer to the original question is, "no".