Home > Blockchain >  How do I make exe file with torch module by using pyinstaller?
How do I make exe file with torch module by using pyinstaller?

Time:10-04

[Environment]

  • vscode
  • Anaconda
  • Window

I successfully ran main_for_exe.py in vscode.

When I make exe file using pyinstaller and then ran exe file, however, I have the below error message.

enter image description here

Now open your project in VS Code, after activating anaconda environment, run pip show numpy to check if its location is anaconda\lib\site-packages. If not, please reinstall it, then regenerate .exe, the error should go away.

Reference: Select and activate Environment.

CodePudding user response:

I solved this problem!

I just upgraded the pyinstaller package.

It seems that the pyinstaller package, before upgrade, cannot find the site-package path where the modules installed by anaconda are located. (Generally site-packe path: "~/anaconda3/lib/site-packages")

In this case, there are two solutions.

  1. First, you just upgrade pyinstaller.
  2. Second, you add site-package path to hookspath and then run "pyinstaller main.spec".
  • Related