Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Problem py2exe
#1
Hello guys, i have a problem with py2exe. When i do this comand i got an error for modules, this

Error:
C:\Users\Game\AppData\Local\Programs\Python\Python35>python setup.py py2exe running py2exe   1 missing Modules   ------------------ ? _cpyHook                            imported from pyHook.cpyHook Building 'dist\Test2.exe'. error: [Errno 2] No such file or directory: 'C:\\Users\\Game\\AppData\\Local\\Programs\\Python\\Python35\\lib\\site-packages\\py2exe\\run_w-py3.5-win-amd64.exe'
I try to move the file cpyHook to the py2exe folder but nothing.. Hope you guys can help me!  Tongue
Reply
#2
can you show us the setup file?

if your not importing these modules you can exclude them
    setup(
    options={'py2exe':{'excludes':['Image','PIL._imagingagg','PyQt4',
    'PyQt5','_abcoll','_imaging_gif','_util','cffi','lxml','openpyxl.tests',
    'readline','tkinter']}},
     )
Recommended Tutorials:
Reply
#3
Thanks for reply, here the setup file
from distutils.core import setup
import py2exe
setup(windows=["Test2.py"])
Reply
#4
can you show the content of Test2.py?
Recommended Tutorials:
Reply
#5
Not really, im working at this one since a lot, need to end it and then i can post :) hope you understand. By tha way is working, i test it, 0 problem. And all the import are ok. There are the import 
from email.mime.multipart import MIMEMultipart
from email.mime.base import MIMEBase
from email import encoders
import pythoncom, pyHook, logging, time, win32console, win32gui, os, smtplib, shutil, win32api, win32con, threading

Reply
#6
Here my script for py2exe,you can include(includes, excludes, packages).
from distutils.core import setup
import py2exe
import sys

def py2_exe(file_in, ico=None):
    if ico == None:
        pass
    else:
        dest_ico = ico.split('.')[0]
    if len(sys.argv) == 1:
        sys.argv.append('py2exe')

    # Py2exe finds most module,here you can include,exclude moduls
    includes = []
    excludes = []
    packages = []
    dll_excludes = []

    # Bundle_files : 3 most stable | bundle_files : 1 create 1 big exe
    setup(options =\
    {'py2exe': {'compressed': 1,
                'optimize': 2,
                'ascii': 0,
                'bundle_files': 2,
                'includes': includes,
                'excludes': excludes,
                'packages': packages,
                'dll_excludes': dll_excludes,}},
                 zipfile = None, #None or "lib\library.zip"

    # Can use console(Command line) or windows(GUI)
    console = [{
              'script': file_in,
              #--| Uncomment for ico
              ##'icon_resources' : [(1, ico)],
              ##'dest_base' : dest_ico
                   }])

if __name__ == '__main__':
    #--| The .py file you want to make exe of
    file_in = 'your.py'
    #--| Ico in same folder as .py
    #ico = 'your.ico'
    py2_exe(file_in)
Could be a tips.
Quote:@Whatevs To compile it (at least with py2exe) copy the _cpyHook.pyd and cpyHook.py
files into the "...Lib\site-packages" directory and it worked for me
Reply
#7
I copy the _cpyHook.pyd and cpyHook.py in site-packages and now i got this error
[size=x-large]
Error:
C:\Users\Game\AppData\Local\Programs\Python\Python35>python setup.py py2exe[/size] running py2exe Building 'dist\Test2.exe'. error: [Errno 2] No such file or directory: 'C:\\Users\\Game\\AppData\\Local\\Programs\\Python\\Python35\\lib\\site-packages\\py2exe\\run_w-py3.5-win-amd64.exe'
Reply
#8
Quote:run_w-py3.5-win-amd64.ex

is your python 32 bit?
Recommended Tutorials:
Reply
#9
Nope, mine is 64
Reply
#10
Though there is success in 64 bit. I have had fewer problems using 32 bit. I purposely use 32 bit when i want to make an exe for this reason alone. But that would require a separate python install, py2exe, and any other 3rd party lib you installed. Im not saying this will fix the problem. Im not sure...i have never seen that error before. But its an option to try.
Recommended Tutorials:
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  [split] Py2exe Writing UNKNOWN-0.0.0-py3.7.egg-info sarahroxon7 1 944 Apr-20-2022, 08:02 AM
Last Post: VadimCr
  Py2exe and pycryptodome reks2004 5 4,210 Dec-16-2020, 06:42 PM
Last Post: reks2004
  Py2exe Writing UNKNOWN-0.0.0-py3.7.egg-info Rickus 2 3,688 Feb-18-2020, 03:09 PM
Last Post: Rickus
  py2exe failed to compiled gahhon 9 7,551 Mar-04-2019, 03:29 AM
Last Post: gahhon
  py2exe keegan_010 4 4,525 Aug-22-2018, 07:58 AM
Last Post: buran
  How would I combine multiple .py files into one .exe with Py2Exe shlomi27 0 3,111 Aug-20-2018, 10:27 AM
Last Post: shlomi27
  jira-2.0.0.dist causing error with py2exe johnlawlor 1 2,532 Aug-09-2018, 08:27 PM
Last Post: Larz60+
  can not open .exe file generated by py2exe: ImportError: cannot import name _remove_d py2exe 0 2,759 May-22-2018, 09:57 AM
Last Post: py2exe
  trouble with pip and py2exe sylas 12 13,820 Sep-17-2017, 06:38 AM
Last Post: sylas
  Convert py2exe daltorya19 6 5,424 May-28-2017, 11:48 PM
Last Post: daltorya19

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020