So I was following this tutorial on how to convert my python project to an executable file: https://dev.to/eshleron/how-to-convert-py-to-exe-step-by-step-guide-3cfi
And I needed to write this function:
def resource_path(relative_path):
""" Get absolute path to resource, works for dev and for PyInstaller """
try:
# PyInstaller creates a temp folder and stores path in _MEIPASS
base_path = sys._MEIPASS
except Exception:
base_path = os.path.abspath(".")
return os.path.join(base_path, relative_path)
However VSCode is giving me this error: Module 'sys' has no '_MEIPASS' member.
I have searched online for quite a long time and I still don't know how to fix it.
question from:
https://stackoverflow.com/questions/65865523/module-sys-has-no-meipass-member 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…