Reprinted:
pycharm works! ——About python’s package import problem from .import failed, or import could not find the file
for memo
Python's package import problem from .import failed, or import could not find the file
This is actually because pycharm does not parse this project as a code package. If a similar problem occurs, it is not because of the code. You only need to modify the settings on pycharm to let the IDE recognize the project package. The steps are as follows:
1. Click on your project file with the mouse, and then select with one click: Mark Directory as>>Sources Root.
2. Then you will find that your folder has changed color, as shown in the figure:
3. Now you can successfully find your own files, and use the from...import... or import statement to import the files
PS: This approach is also applicable to other IDEs developed by pycharm's company.
IDE products of JetBrains: http://www.jetbrains.com/
AppCode
CLion
Datalore
DataGrip
GoLand
IntelliJ IDEA
PhpStorm
PyCharm
Rider
RubyMine
WebStorm
—————————————————
Copyright Notice: This article is a CSDN blog The original article of the main "Ou Cheneli" follows the CC 4.0 BY-SA copyright agreement. For reprinting, please attach the original source link and this statement.
Original link: https://blog.csdn.net/xiao_yi_xiao/article/details/101793655