1

I'm trying to run a python script through nodejs pythonshell but I keep getting a modulenotfound error when trying to import the libraries that I downloaded with pip. I installed pythonshell on my computer with npm, so I know that's not the problem.

1
  • 1
    Pls add some details about the error you're getting. Post it here. Commented Jun 24, 2020 at 15:15

1 Answer 1

1

When you install packages you will install them to a directory named site-packages

In your main directory this can be found from: your-directory/lib/Python3.6/site-packages

If you copy and paste the files you'd like to run into this folder, and change the script path accordingly, the file will find all imported modules.

This is because the python shell was looking in the current directory for your packages and not finding them.

Sign up to request clarification or add additional context in comments.

4 Comments

I'm trying to make an application with multiple scripts and sub directories that will eventually get turned into an exe file, so I'm not sure how feasible this is.
Just try packaging it and see how it runs.
I tried placing my project folder inside the site-packages folder and I got the same error
It worked! Now I am not getting the modulenotfound error, but another error later in code @Helix

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.