I want to create a simple .exe file of a simple python script with pyinstaller. I follow the guide (https://www.pyinstaller.org/) :
- pip install pyinstaller
- pyinstaller yourprogram.py
But I do not obtain my .exe file in the DIST folder as explained in https://pyinstaller.readthedocs.io/en/stable/usage.html :
In the dist folder you find the bundled app you distribute to your users.
I use Python 3.7.6 with anaconda. I download first the PyInstaller from www.pypi.org/project/pyinstaller/, it is the version 4.2 but it gives me the same following error, so I tried with the latest version 5.0 which is in developpement.
In my case, I executed in the Anaconda Prompt :
C:\Users\David Gomez\Desktop\test>pyinstaller simple.py
I obtain :
1418 INFO: PyInstaller: 5.0.dev0
1418 INFO: Python: 3.7.6 (conda)
1418 INFO: Platform: Windows-10-10.0.19041-SP0
1432 INFO: wrote C:\Users\David Gomez\Desktop\test\simple.spec
1434 INFO: UPX is not available.
script 'C:\Users\David Gomez\Desktop\test\simple.py' not found
The script is then not found. After some research, I thought the probleme was the space in my path between my name "David Gomez", so I wrote the path with quotes:
C:\Users\David Gomez\Desktop\test>pyinstaller "C:\Users\David Gomez\Desktop\test\simple.py"
But the same error remains.
Then I found another personne having the same problem (Script not found when using pyinstaller), but the answer is not convincing and I clearly do not want to install another python. I create a new topic because that one is not updated anymore, the proposed solution :
I found the solution. I had to first install Python from their own website instead of the Windows store. Then I had to add it to a PATH. After this it still did not work because I used Python 3.8.0, so I had to install pyinstaller development version.
Any ideas what the problem could be? Any help or guesses are appreciated. If there is a need for further clarification, let me know.
Edited part
When I check my folder with the command dir, I obtain :
C:\Users\David Gomez\Desktop\test>dir
Le volume dans le lecteur C s’appelle Windows
Le numéro de série du volume est 3AFA-C44C
Répertoire de C:\Users\David Gomez\Desktop\test
15.03.2021 11:20 <DIR> .
15.03.2021 11:20 <DIR> ..
11.03.2021 15:52 160 simple.py.py
1 fichier(s) 160 octets
2 Rép(s) 166,905,487,360 octets libres
Then, I do the command C:\Users\David Gomez\Desktop\test>pyinstaller "C:\Users\David Gomez\Desktop\test\simple.py" and two new empty folders are created (build, dist) and a file simple.spec. Normally, if everything works corectly the folders are not empty. Now if I check again my folder with dir command :
C:\Users\David Gomez\Desktop\test>dir
Le volume dans le lecteur C s’appelle Windows
Le numéro de série du volume est 3AFA-C44C
Répertoire de C:\Users\David Gomez\Desktop\test
11.03.2021 16:57 <DIR> .
11.03.2021 16:57 <DIR> ..
11.03.2021 16:57 <DIR> build
11.03.2021 16:57 <DIR> dist
11.03.2021 15:52 160 simple.py.py
11.03.2021 17:41 1,059 simple.spec
2 fichier(s) 1,219 octets
4 Rép(s) 166,908,215,296 octets libres
Simply.py is in the folder but not found by pyinstaller, I still have no idea what to do.
I do not know if it is usefull but here you have the content of the simple.spec :
# -*- mode: python ; coding: utf-8 -*-
block_cipher = None
a = Analysis(['simple.py'],
pathex=['C:\\Users\\David Gomez\\Desktop\\test'],
binaries=[],
datas=[],
hiddenimports=[],
hookspath=[],
runtime_hooks=[],
excludes=[],
win_no_prefer_redirects=False,
win_private_assemblies=False,
cipher=block_cipher,
noarchive=False) pyz = PYZ(a.pure, a.zipped_data,
cipher=block_cipher) exe = EXE(pyz,
a.scripts,
[],
exclude_binaries=True,
name='simple',
debug=False,
bootloader_ignore_signals=False,
strip=False,
upx=True,
console=True ) coll = COLLECT(exe,
a.binaries,
a.zipfiles,
a.datas,
strip=False,
upx=True,
upx_exclude=[],
name='simple')