2

I'm trying to package up my python file into an .exe file using pyinstaller.

I managed to install pyinstaller with pip but when trying to use pipinstaller in a command window it wouldn't work. I found online to use python -m PyInstaller instead which then worked. But after using cd to change the directory and then doing python -m PyInstaller filename.py it would always give a list of errors saying 1920, 'LoadLibraryExW', 'The file cannot be accessed by the system.'.

I'm using windows 10, python 3.8.3 and the newest version of pip but I couldn't find a soloution. I ran command prompt as an operator but it still wouldn't help.

Any soloutions?

1
  • 1
    Did you install python from the windows store? Commented Jun 1, 2020 at 0:20

3 Answers 3

4

Go to the path you've installed your python

if you don't know where you installed python, in the console type 'where python'

> where python
C:\Users\{username}\AppData\Local\Programs\Python\Python38\python.exe

then go to the path

next, go to 'Scripts' folder

cd Scripts

in the Scripts folder, make sure there is pyinstaller.exe file there

if you find pyinstaller.exe in this folder, you are sure pyinstaller is installed on your system, then

> pyinstaller {path to the main.py}

there is two useful switch for pyinstaller

  1. --onefile >> your project packaged into ONE file
  2. --noconsole >> no console appear when your app is running

For eg:

pyinstaller d:\myapp\main.py --onefile

You can find your final dot.exe file in the 'dist' folder in 'Scripts' folder

example

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

Comments

0

I encounter the same question, so I uninstall python which is installed from windows appstore, and reinstall it from the website, and it works fine now, hope it help

Comments

0

I decided to try another one after failing to use pyinstaller. I used py2exe and shortly after trying managed to convert it into an .exe file along with moving my files inside of where my python was stored.

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.