Ask Your Question
2

What is the reason for encountering a ModuleNotFoundError when using my own modules in Python3?

asked 2022-04-16 11:00:00 +0000

bukephalos gravatar image

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2022-03-04 18:00:00 +0000

david gravatar image

There can be many reasons for encountering a ModuleNotFoundError when using your own modules in Python3. Some possible reasons include:

  1. Incorrect module name or file name: Make sure that the name of your module and the file name match, and that the file is saved with a .py extension. Also ensure that the module is saved in the correct directory.

  2. Incorrect import statement: Make sure that you are importing the module correctly, using the correct syntax for your particular situation. For example, if your module is in a subfolder, you may need to use a relative import.

  3. Module not installed: If you are trying to use a third-party module that is not installed on your system, you will need to install it first using pip.

  4. Environment issues: Sometimes, the environment or system settings can cause problems with finding modules. Check to make sure that your Python environment is set up correctly, including any virtual environments you may be using.

  5. Python version incompatibility: If your module was written using an earlier version of Python, it may not be compatible with Python3. Check that your code is compatible with the version of Python you are using.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss

Add Answer


Question Tools

Stats

Asked: 2022-04-16 11:00:00 +0000

Seen: 8 times

Last updated: Mar 04 '22