简体   繁体   中英

Error opening python executable in Windows after using Pyinstaller

I am trying to use Pyinstaller to create a python 2.7 executable in windows 7. I followed all the suggestions in the manual (using pip-win and Pywin32) but once the file has been created I cannot open the application and I get the error message:

"Windows cannot access the specified the specified device, path, or file. You may not have the appropriate permissions to access the item."

Does anyone have any idea why this might be happening and what I can do to prevent it? Sorry if this question is a bit vague, I will try and provide more details if I can.

Thanks in advance

this isn't a direct solution to your question, but it might be a good workaround. instead of packaging your python script in a .exe file, just use py.exe to start your .py file using: http://www.orbitals.com/programs/pyexe.html

your file may be denied to access. Every files in the network or any other system may needs digital signature. I have find the tutorial to gain file access through the liked site.

I had this same problem after I turned my .py file to an .exe file using pyinstaller (I'm using Python 3.6).

It would run fine on my computer, but when sending it to others to run, firstly the computer would try to stop it from running (understandable, but you can tell Windows that you trust it when the pop-up appears). It would then be saved to their computer. I tried to run the file and got the same pop-up you did. I figured it was their anti-virus stopping it from running, so opened the anti-virus software and added an exception for my file. After that it worked fine.

Granted, it's an inconvenient way to do it, but until I learn further it works for now.

I had the same problem since today (the last days was working fine). I figured out that the problem was when I create the .exe file with --icon, if you don't create the file with the --icon should work fine.

after hours and bad answers i found this and worked: Pyinstaller exe not working on other computer(with other windows ver.)

in short: find the location of pythonXX.dll and add it to the libraries example command:

pyinstaller -F --icon "C:/iconspath/ico.ico" --add-data "C:/pythoninstallpath/python37.dll;."  .\mypyprogram.py 

or simpler send both the generated exe and the pythonXX.dll

(XX is the version in my case is python37.dll)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM