简体   繁体   中英

ModuleNotFoundError: No module named 'Libraries'

I have default directory in PyCharm named "Libraries" this is where all my python files are located. When I import files using the following it does not work.

from Libraries.my_python_file import my_function

But when I use file name without "Libraries." prefix it works

from my_python_file import my_function

Can anyone help me understand what it is that I am doing wrong?

I have the environment variable path set to the following

  • C:\Users\username\AppData\Local\Programs\Python\Python38\
  • C:\Users\username\AppData\Local\Programs\Python\Python38\Scripts\

Try adding empty file __init__.py in Libraries directory.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM