Reputation: 41
I'm trying to create an executable file for a simple 'Hello World' python code. I'm using an Ubuntu Subsystem in Windows 11 and I'm trying to create the .exe file with the command:
pyinstaller --onefile Test.py
The command runs and creates folders "build" and "dist", but it doesn't create the .exe file inside the "dist" folder as it should do.
In the terminal I have the fallowing message:
mbseidel@Matheus-Seidel:/mnt/c/Users/Matheus Seidel/OneDrive/NCEE Meus documentos/Arquivos padrão/Up$ pyinstaller --onefile Test.py
156 INFO: PyInstaller: 5.7.0
156 INFO: Python: 3.8.10
166 INFO: Platform: Linux-4.4.0-25272-Microsoft-x86_64-with-glibc2.29
173 INFO: wrote /mnt/c/Users/Matheus Seidel/OneDrive/NCEE Meus documentos/Arquivos padrão/Up/Test.spec
181 INFO: UPX is not available.
183 INFO: Extending PYTHONPATH with paths
['/mnt/c/Users/Matheus Seidel/OneDrive/NCEE Meus documentos/Arquivos padrão/Up']
648 INFO: checking Analysis
648 INFO: Building Analysis because Analysis-00.toc is non existent
648 INFO: Initializing module dependency graph...
651 INFO: Caching module graph hooks...
656 WARNING: Several hooks defined for module 'numpy'. Please take care they do not conflict.
662 INFO: Analyzing base_library.zip ...
1652 INFO: Loading module hook 'hook-heapq.py' from '/home/mbseidel/.local/lib/python3.8/site-packages/PyInstaller/hooks'...
1802 INFO: Loading module hook 'hook-encodings.py' from '/home/mbseidel/.local/lib/python3.8/site-packages/PyInstaller/hooks'...
2734 INFO: Loading module hook 'hook-pickle.py' from '/home/mbseidel/.local/lib/python3.8/site-packages/PyInstaller/hooks'...
3599 INFO: Caching module dependency graph...
3695 INFO: running Analysis Analysis-00.toc
3808 INFO: Analyzing /mnt/c/Users/Matheus Seidel/OneDrive/NCEE Meus documentos/Arquivos padrão/Up/Test.py
3812 INFO: Processing module hooks...
3823 INFO: Looking for ctypes DLLs
3827 INFO: Analyzing run-time hooks ...
3831 INFO: Looking for dynamic libraries
4781 INFO: Looking for eggs
4781 INFO: Python library not in binary dependencies. Doing additional searching...
4958 INFO: Using Python library /lib/x86_64-linux-gnu/libpython3.8.so.1.0
4979 INFO: Warnings written to /mnt/c/Users/Matheus Seidel/OneDrive/NCEE Meus documentos/Arquivos padrão/Up/build/Test/warn-Test.txt
4995 INFO: Graph cross-reference written to /mnt/c/Users/Matheus Seidel/OneDrive/NCEE Meus documentos/Arquivos padrão/Up/build/Test/xref-Test.html
5054 INFO: checking PYZ
5054 INFO: Building PYZ because PYZ-00.toc is non existent
5054 INFO: Building PYZ (ZlibArchive) /mnt/c/Users/Matheus Seidel/OneDrive/NCEE Meus documentos/Arquivos padrão/Up/build/Test/PYZ-00.pyz
5204 INFO: Building PYZ (ZlibArchive) /mnt/c/Users/Matheus Seidel/OneDrive/NCEE Meus documentos/Arquivos padrão/Up/build/Test/PYZ-00.pyz completed successfully.
5220 INFO: checking PKG
5221 INFO: Building PKG because PKG-00.toc is non existent
5221 INFO: Building PKG (CArchive) Test.pkg
7126 INFO: Building PKG (CArchive) Test.pkg completed successfully.
7132 INFO: Bootloader /home/mbseidel/.local/lib/python3.8/site-packages/PyInstaller/bootloader/Linux-64bit-intel/run
7133 INFO: checking EXE
7133 INFO: Building EXE because EXE-00.toc is non existent
7133 INFO: Building EXE from EXE-00.toc
7134 INFO: Copying bootloader EXE to /mnt/c/Users/Matheus Seidel/OneDrive/NCEE Meus documentos/Arquivos padrão/Up/dist/Test
7138 INFO: Appending PKG archive to custom ELF section in EXE
7184 INFO: Building EXE from EXE-00.toc completed successfully.
It is weird because I tried the same thing a week ago and the .exe was created normally. I even tried unistalling and reinstalling the pyinstaller library, but still got the same results.
Upvotes: 1
Views: 304
Reputation: 216
Since you're creating an executable under WSL, a Linux environment, your output executable would be that of a Linux binary instead of a Windows .exe
file.
Linux binary do not an extension, but they will still be properly run if you run the path to the binary file under your WSL shell (e.g. ./path_to_binary/binary_file
)
If you wish to create an executable for Windows, the simplest way is to run the same code with pyinstaller on Windows itself rather than the WSL shell.
Upvotes: 2