简体   繁体   中英

py2exe won't properly compile my application

I've never used py2exe before. I installed the package, created a setup.py, ran it and it seemed to work without any obvious errors. I went into the dist folder it created and tried to run the exe but I'm getting this error:

Traceback (most recent call last):
  File "rl2.py", line 3, in <module>
  File "libtcodpy.pyc", line 41, in <module>

  File "ctypes\__init__.pyc", line 428, in __getitem__
  File "ctypes\__init__.pyc", line 423, in __getattr__
  File "ctypes\__init__.pyc", line 353, in __init__
WindowsError: [Error 126] The specified module could not be found

How can I solve this?

What exact commands did you use to get this output?

I recommend using PyInstaller. You can build an EXE with PyInstaller using this command:

"python pyinstaller.py -y -w -F [PATH\\TO\\SCRIPT.py] -n [PROJECT_NAME]"

  1. -y: answer yes to every question
  2. -w: windowed (does not show commandline when running)
  3. -F: Compile into one EXE instead of a directory with .dll files
  4. -n: assign project name

Hope I helped

You probably need to manually specify ctypes in the packages section of your setup.py.

See here

I had same issue today. HEre is the solution will work 100%

The meaning of error is the imported dll file in your code is misssng in created dist folder. so you have to copy and paste dll file in dist folder, and it will work.

I used logimove.dll file and same issue. so i put logimove.dll file in dist file and it works. :)

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