无法在 Python 中导入库

Can't import library in Python

运行 python3 xx.py 在我的特定文件夹中

shows Import Error

但是,我转到我的主目录,并使用相同的代码添加新文件 然后它可以很好地工作。为什么?

这两个我都勾选了sys.path,路径是一样的

  1. 找到pycache,init.py

    ls -l

  2. 删除它

    rm -rf "pycache" "init.py" it works!

终于解决了