-1

I want to create a simple .exe file of a simple python script with pyinstaller. I follow the guide (https://www.pyinstaller.org/) :

  1. pip install pyinstaller
  2. 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')

3 Answers 3

0

Your issue doesnt have to do with your pyinstaller install location, but rather the simple.py file doesnt exist in that directory. (At least thats what it seems like to me)

Sign up to request clarification or add additional context in comments.

6 Comments

Sorry, I just edited my post. I made some errors when I copied the path. Now you can see clearly that the file exists in my folder: C:\Users\David Gomez\Desktop\test>pyinstaller "C:\Users\David Gomez\Desktop\test\simple.py" I am in the test folder and execute pyinstaller with the file simple.py, which is in the folder. Others ideas?
Could you run the ls command to see the contents of that directory? @DavidAndréGomezRomero
I am working on windows so when I do the dir command, 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 @101donutman
I have updated my post from the part: "Edited part". I hope this information is helpful and let me know if you have any other ideas. Thanks
Your problem is that your file is named simple.py.py instead of simple.py. Thus the file simple.py does not exist within that directory. @DavidAndréGomezRomero
|
0

it may sound weird but try typing

pyinstaller your_script.py.py

when you try creating a file with .py in an editor and you do not have the name to affect the file in windows (or any other operating system) the editor will create

file.py.py

so be aware of that :)

Comments

0

July 2023. Solution: I got the same issue about script not found. How I was able to solve, finally...

  1. deleted all old build and dist folders
  2. renamed new_code.py to newcode.py (removed underscore)
  3. transferred this newcode.py to the folder where PyInstaller was located
  4. ran the command pyinstaller --onefile code.py from there.

It finally worked, to my relief! :)

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.