How To Download __EXCLUSIVE__ Py2exe Module

0 views
Skip to first unread message

Albert Phelps

unread,
Jan 21, 2024, 1:04:10 PM1/21/24
to mengistmavi

py2exe is a software to build standalone Windows executable programs from Pythonscripts. py2exe can build console executables and windows (GUI) executables.py2exe supports the Python versions* included in the official development cycle.

how to download py2exe module


DOWNLOAD https://t.co/ZPbFT2J9sc



I had a different problem with py2exe failing to find pywintypes27.dll - it was failing to find the file inside build_exe.isSystemDLL. The solution is to add the location of the DLLs in the path (at least the hack is to do so):

py2exe tries to create a graph of all the dependencies, starting with your entry point script. It can't always get it 100% correct, which is why you are provided the includes and excludes options to fine tune the package.

Sometimes modules you didn't want will get included and if this happens just add them to the exclude. I suppose the answer to your question would be: manage the setup.py manually when the out-of-the box options don't package it exactly how you want.

I've built a ton of apps using the very similar py2app for osx. Over the course of different versions, sometimes they change the way it discovers dependencies. It also uses various "recipes" for how to handle certain packages like Qt. A newer version of p2app suddenly started including all of the PyQt modules instead of just the two I used. So, I had to add them to my excludes.

Replacing CollabNet SVN with VisualSVN (including a couple of reboots) did the trick. I know this is not a "pretty" solution, as it caused me to uninstall CollabNet SVN - a prettier solution might have been doing modifications to the PATH env. variable... However, I am now able to use py2exe :)

After writing all the code I decided to make an exe in order to ease the deployment of my project on windows. For this purpose I decided to use py2exe which suited best to my needs. However it is necessary to know that py2exe is not the only Python to exe compiler out there. Some of the other popular Python exe makers out there are pyinstaller and cx_freeze.

Another error I came across while compiling a PyQt4 script was the ImportError: No module named sip error. This one was pretty easy to solve. The solution was located on py2exe website. One solution was to use py2exe like this:

Previously I use innosetup to make an installer but later I came across another method which allowed me to use py2exe to directly create a bundled exe which could be run by double clicking. In order to achieve this I modified my setup.py file like this:

Using PyQt4 / Python 3.4, and wanting a single executable (not a folder of files), I think that limits me to using py2exe instead of some of the other newbie-friendly gui-based tools (cx_freeze , pyInstaller, etc).

PY2EXE (or CXFreeze) all seem to be hit and miss at times and gathering from all the forum chatter, needs a lot of tweaking at time.Other issues I ran into: Ex. the vlc binding might not py2exe properly work depending on the vlc.py and python versions you are trying, then furthermore it may or may not py2exe properly depending on the bundle option.Currently also having problems trying to py2exe an app that uses pysnmp (4.2.5 and/or 4.3) .

Second (and I'm not entirely sure why), always keep your py2exe setup.py script in the exact folder where your main script is. I've tried modifying py2exe's 'script' option to allow my script to be somewhere else... but your exact problem happened to me. So, try making sure it is right where the main script is.

Finally, you can always give py2exe a little help. I usually have to add the root directory to the system path so the import statements are valid. Note, I'm not modifying sys.path in any of my application's code - only the py2exe script I use to build the exe.

I'm not sure that py2exe now how to handle the from ..some_Mod import * syntax, check this to ensure that the some_Mod.py module is correctly packaged : python -m py2exe.mf -d some_dir/another_dir/some_Mod.py as explained in the py2exe FAQ

So I've had a go at trying to install py2exe however I have been slapped in the face with a road block. even after installing idle-python3 and the python3-minimal I will be posting the logging info along with this error message for py2exe install issues.

In normal python, this works well. However, py2exe leaves these files out. I assume that because they are not explicitly imported, py2exe doesn't believe they are needed. Is there a solution to this? Some option in py2exe that I'm unaware of?

I'm trying to convert my python project into an exe using Py2Exe. It is worth noting that cx_freeze complains about the same three "missing modules", along with several dozen others. The problem is, no one anywhere tells how to resolve this.

All in all - py2exe notices that these modules/packages are referenced by some code which will be included into your exe (it even mentions the modules that reference these mod/packages: cmd, code, pdb, platform).I hope you have tested your script - in the 'non-compiled' form, if it works correctly than you can safely ignore these messages: they are only warnings.

I am using py2exe-0.6.9.win32-py2.7.exe and converted a .py file to .exe. The problem is that it won't open as it says something like 'unable to import Frame' when I try to open the .exe file. 'Frame' is another .py file which I wrote some code in.

EDIT: I understood the problem. the modules present only in C:\Python27\Lib\site-packages\ gets imported by the .exe file. The question now is do I have to copy every module the .exe file is trying to import to C:\Python27\Lib\site-packages\ before running py2exe or is there any other easier way?

Here is what finally worked for me.Manually copying the folder containing the files which your .py(to be converted to .exe) file imports, before running py2exe, to Python27\Lib\site-packages\ fixes such problems I guess.

Executing Python scripts requires a lot of prerequisites like having Python installed, having a plethora of modules installed, using the command line, etc. while executing an .exe file is very straightforward.

The most popular way to achieve this is by using the py2exe module. In this article, we'll quickly go through the basics of py2exe and troubleshoot some common issues. To follow along, no advanced Python knowledge is needed, however you will have to use Windows.

py2exe doesn't support on Linux or Mac, as it's aimed to create .exe files which is a Windows-unique format. You can download a Windows virtual machine on both Mac and Linux, use Wine or use a different tool like Pyinstaller on Linux, or py2app on Mac.

The py2exe project used to be the primary way to create Windows executables from your Python applications. The regular version of py2exe just supports Python 2.3-2.7. There is a new version listed on PyPI that will work with Python 3.4 as well. We will focus on the Python 2.x version, although this chapter should work with the Python 3 version too.

The key to any py2exe script is the setup.py file. This file controls what gets included or excluded, how much we compress and bundle, and much more! Here is the simplest setup that we can use with the wx script above:

As you can see, we import the setup method from distutils.core and then we import py2exe. Next we call setup with a windows keyword parameter and pass it the name of the main file inside a python list object. If you were creating a non-GUI project, than you would use the console key instead of windows. To run this snippet, save it into the same folder as your wxPython script, open up a command prompt and navigate to the location that you saved the two files. Then type python setup.py py2exe to run it. If all goes well, you will see a lot of output ending with something like this:

At this point, you should know enough to get started using py2exe yourself. You can get busy and start distributing your latest creation now. It should be noted that there are several alternatives to py2exe, such as bbfreeze, cx_freeze and PyInstaller. You should try at least a couple of the others to see how they compare. Creating executables can be frustrating, but have patience and persevere through it. The Python packaging community is quite willing to help. All you need to do is ask.

File "run.py", line 29, in import matplotlib.pyplot as plt File "matplotlib\pyplot.pyc", line 95, in File "matplotlib\backends__init__.pyc", line 25, in pylab_setup ImportError: No module named backend_tkagg

If you are using py2exe it doesn't handle .egg formatted Python modules. If you used easy_install to install the trouble module then you might only have the .egg version. See the py2exe site for more info on how to fix it.

Packaging tools such as py2exe and cx_Freeze determine the dependenciesthat have to be included in a package by recursively finding the modulesfrom the import statements used. Recursive finding of modules from theimport statements uses straight forward approach i.e., if the pythoncode dynamically imports certain modules by modifying the sys.path atruntime or if the code uses __import__ statements, those modulesare likely to be left out by the packaging tool. This can be a problemfor some packaged applications.

PyPubSub supports two different messaging protocols namely args1 andkwargs; choosing and switching between these protocols is done bymodifying the module path dynamically. This can result in import errorlike this at runtime:

The line 'packages': 'encodings, pubsub' explicitlytells py2exe to include pubsub as a package so that the entire pubsubfolder (from the installation location) including its sub packages areincluded for packaging. As the package has the entire list of pythonmodules under pubsub, runtime protocol selection is now possible inthe generated exe file.

At F-Secure we often encounter binary payloads that are generated from compiled Python. These are usually generated with tools such as py2exe or PyInstaller to create a Windows executable. A notable example was the Triton malware recently discovered by FireEye[1], which used this exact technique.Due to the variety of payloads seen we frequently relied on multiple decompilation scripts or manual human intervention to obtain the source code. To speed this process up we decided to create a single analysis script that could decompile both py2exe and PyInstaller files and provide us the output.

f5d0e4f075
Reply all
Reply to author
Forward
0 new messages