ImportError: No module named os when Running .exe file py2exe

752 Views Asked by At

I've created an .exe of my python file. When I run the .exe file I get the following error message:

Traceback (most recent call last):

File "C:---\Anaconda2\lib\site-packages\py2exe\boot_common.py", line 92, in

import linecache

ImportError: No module named linecache

Traceback (most recent call last):

File "mypythonfile.py", line 8, in

ImportError: No module named os'

1

There are 1 best solutions below

0
On

Delete the . exe file and just run (x is package)

pip install x
pip install module 

Then create again the executable file with pyinstaller. It worked for me.