import extruct
def main():
input("Hello")
if __name__ == '__main__':
main()
This is the code that I converted into an exe file with pyinstaller. If I open this file now, the exe crashes directly. At the bottom is the message:
FileNotFoundError: [WinError 3] The system cannot find the specified path: 'C:\Users\test\AppData\Local\Temp\_MEI801802\mf2py\backcompat-rules'"
It is definitely because I am importing "extruct". But I need this library for the correct code. Does anyone know how I can fix this error?
I got it to work... these are the steps I took. Im using windows. On another operating system the only changes that need to be made are the virtual environment path to the bakcompat-rules directory.
main.py
filepy -m venv venv
venv/Scripts/activate
py -m pip install --upgrade pip pyinstaller extruct
pyinstaller -F main.py
import os
data = []
parent = "./venv/Lib/site-packages/mf2py/backcompat-rules/"
for item in os.listdir(parent):
path = os.path.join(parent, item)
target = parent
data.append((path, "mf2py/backcompat-rules"))
Analysis
signature change datas=[],
to datas=data,
pyinstaller main.spec
dist/main.exe
And it should run fine.
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.