The pycharm import module shows that there is no solution

Recently, in the same level or different level directory, import a certain module, it shows that it does not exist, but it clearly exists. Baidu searched a lot and couldn’t find it, so I tried it.

import sys
sys.path.append('/path/to/test') // 这里可以用os.path类方法自动获得绝对路径

This method doesn't work

Solution: pycharm will not automatically add the current file directory to its source_path. Right-click make_directory as-->sources path to add the current working folder to source_path .


Related Posts