Py2exe for Python 3.5.2 not working - python-3.x

C:\Users\Other\Desktop\DoA-Tools>python "C:/Users/Other/Desktop/DoA-Tools/convert doa-tools.py" py2exe
running py2exe
1 missing Modules
------------------
? readline imported from cmd, code, pdb
Building 'dist\DoA-Tools.exe'.
error: [Errno 2] No such file or directory: 'C:\\Users\\Other\\Desktop\\Python3.5.2\\lib\\site-packages\\py2exe\\run-py3.5-win32.exe'
I downloaded py2exe (pip install py2exe), and Im using Python 3.5.2. I have a script that I need to be an executable file, but I keep getting the above error when I try python <filename> py2exe. Any ideas? I tried to remove and redownload, but that didn't work

Related

I'm unable to create the .exe for the most simple 'hello world' example

I've used py2exe successfully for previous projects on previous build machines, but now I've freshly installed everything from scratch and can't run the simplest example:
setup.py:
from distutils.core import setup
import py2exe
setup(console=['hello.py'])
hello.py:
print("Hello World")
Command: python3 setup.py py2exe
Output:
running py2exe
1 missing Modules
------------------
? _posixshmem imported from multiprocessing.resource_tracker, multiprocessing.shared_memory
Building 'dist\hello.exe'.
error: [WinError 87] The parameter is incorrect.
dest\hello.exe is generated (37 kB!) but gives the following error when run:
Could not locate script resource:The specified resource type cannot be found in the image file.
FATAL ERROR: Could not locate script
The versions I have installed are:
python --version
Python 3.8.6
pip freeze
cachetools==4.1.1
future==0.18.2
numpy==1.19.3
opencv-python==4.4.0.46
pefile==2019.4.18
py2exe==0.10.1.0
pyreadline==2.1
pywin32==300
systeminfo
OS Name: Microsoft Windows 10 Pro
OS Version: 10.0.19041 N/A Build 19041
OS Manufacturer: Microsoft Corporation
OS Configuration: Standalone Workstation
OS Build Type: Multiprocessor Free
Hotfix(s): 6 Hotfix(s) Installed.
[01]: KB4580419
[02]: KB4561600
[03]: KB4577266
[04]: KB4580325
[05]: KB4586864
[06]: KB4586781
Hyper-V Requirements: A hypervisor has been detected. Features required for Hyper-V will not be displayed.
I know that there is clearly something weird happening (I've already hit the issue with 'numpy' here: https://developercommunity.visualstudio.com/content/problem/1207405/fmod-after-an-update-to-windows-2004-is-causing-a.html ) ... but I can't quite see what it is.
Thanks !
-- Mac
You just misstyped the command line flag, should be: python setup.py py2exe.
Works fine for me on Win7, Python 3.8.0:
(py38) λ python setup.py py2exe
running py2exe
2 missing Modules
------------------
? _posixshmem imported from multiprocessing.resource_tracker, multiprocessing.shared_memory
? readline imported from cmd, code, pdb
Building 'dist\hello.exe'.
Building shared code archive 'dist\library.zip'.
Copy c:\users\f3k\envs\py38\scripts\python38.dll to dist
...
Copy DLL C:\Python38\DLLs\libffi-7.dll to dist\
C:\temp
(py38) λ dist\hello.exe
Hello World

"Error loading Python lib" when trying to run a python script as an executable

I am hoping to turn my python3 script into a distributable application but I'm having trouble turning the script into an executable.
I've tried using
pyinstaller myscript.py
and
pyinstaller --onefile myscript.py
to create the .exe file, however both times I've tried the .exe after it has been created, it's produced this error or a very similar error:
[4129] Error loading Python lib
'/var/folders/c9/r16n40jd14d9x5f__gb0p3t80000gp/T/_MEIyzoWbA/Python':
dlopen:
dlopen(/var/folders/c9/r16n40jd14d9x5f__gb0p3t80000gp/T/_MEIyzoWbA/Python,
10): no suitable image found. Did find:
/var/folders/c9/r16n40jd14d9x5f__gb0p3t80000gp/T/_MEIyzoWbA/Python:
code signature invalid for
'/var/folders/c9/r16n40jd14d9x5f__gb0p3t80000gp/T/_MEIyzoWbA/Python'
The script I'm trying to run doesn't involve any images but it uses selenium webdriver, I'm very new to python so I don't know if either of these things would be a problem.
I have also tried uninstalling python3.8 and installing python3.7.9 but this has not worked either.

Creating .exe file from python package for windows10

I implemented one package with GUI based on Pyside2. This package has the following structure:
Repository
Function
GUI_class
Main_GUI.py
It means Main_GUI.py use some classes and function in GUI and Function folders. Now I want to create the executable version from it for windows 10. I tried Pyinstaller for this aim like the following comments:
(conda env)F:\Repository> Pyinstaller Main_GUI.py
But when I run the *.exe file in dist folder it gives me the following error:
ModuleNotFoundError: No module named 'pkg_resources.py2_warn'
Blockquote[15728] Failed to execute script pyi_rth_pkgre
Would you please help me how can I convert this python package to *.exe? Thank you in advance.
These are my version of my dependencies:
Python 3.6.10,
Pyinstaller 3.6,
Pyside2 5.13.2.

error: [Errno 2] Python3

I'm trying to convert a py file to a .exe using cx_Freeze. I used Python 3.6 to made the program and I'm using a Mac.
I've watched many tutorials on YouTube and I understand I have to create a file named setup.py with the following code:
from cx_Freeze import setup, Executable
setup(name='program',
version='0.1',
description = 'program for mun',
executables = [Executable('main.py')]
)
And then when in Terminal I must enter:
python3 setup.py build
After some seconds it shows the following error:
error: [Errno 2] No such file or directory: '/Library/Frameworks/Tcl.framework/Versions/8.5/Tcl'
Does anyone know why? Thanks.

py2exe No such file or directory

I am following the tutorial here and when I try to run setup.py I get this
running py2exe
Building 'dist\test.exe'.
error: [Errno 2] No such file or directory: 'C:\\Anaconda3\\lib\\site-packages\\py2exe\\run-py3.5-win-amd64.exe'
What am I doing wrong?
What is your python version? py2exe does not support Python 3.5, but you can use Python 3.4 or lower.

Resources