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.
Related
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
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.
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.
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
When I try to build a minimal Cython file test.pyx with Python 3.3 (Anaconda 3) under windows 7, I obtain a strange error:
C:\Users\myname\Test_cython>python setup.py build
running build
running build_ext
error: [WinError 2] The system cannot find the file specified
Of course test.pyx is in the working directory. It works fine under windows with Python 2.7 (Anaconda) and under Linux with Python 2 and 3.
What could be the problem here with Python 3.3 (Anaconda 3)?
Thanks
The file setup.py:
from distutils.core import setup
from distutils.extension import Extension
from Cython.Distutils import build_ext
setup(
name = 'test',
cmdclass = {"build_ext": build_ext},
ext_modules = [Extension('test', ['test.pyx'])]
)
Solution:
I found that the line 404 of the file cygwinccompiler.py of the package disutils
out_string = check_output(['gcc', '-dumpmachine'])
has to be changed as
out_string = check_output(['gcc', '-dumpmachine'], shell=True)
Then, it compiles normally.
The line 404 of the file cygwinccompiler.py of the package disutils
out_string = check_output(['gcc', '-dumpmachine'])
has to be changed as
out_string = check_output(['gcc', '-dumpmachine'], shell=True)
Then, it compiles normally.