Module Not Found Error in Python 3.6 on windows command prompt

后端 未结 1 1343
轻奢々
轻奢々 2021-01-06 15:15

I have created a project like the below one:

project
|
| --package1
|      |
|      -- __init__py
|      --module1.py
|
| --package2
       |
       --__init         


        
相关标签:
1条回答
  • 2021-01-06 15:58

    By default, python only searches current directory. So you'll need to append the path a bit.

    In module 2:

    import sys
    sys.path.append('C:\PathTo\project\package1')
    import module1
    

    That should fix the issue you were having.

    0 讨论(0)
提交回复
热议问题