"File not found" error with py2exe

Josh Smith

I recently installed py2exe to attempt to convert some simple python scripts to executables. I'm using Anaconda with python 3.4 and I downloaded the most recent(?) package of py2exe: 0.9.2.2 -- I used the .whl file from https://pypi.python.org/pypi/py2exe/

Everything seemed to work fine. As some suggested, I disabled my antivirus before running the installer:

    <path to pip.exe> install <path to py2exe.whl file>

but when I tried to convert a simple example file using build_exe test.py, I got the error: error:

[Errno 2] No such file or directory: 'C:\Anaconda3\lib\site-packages\py2exe\run-py3.5-win-amd64.exe'

I checked the directory and, sure enough, that file doesn't exist....and I'm not even using v3.5, I have v3.4 so the file I think it should be looking for is "run_w-py3.4-win-amd64.exe" (which is there).

I tried running the converter another way, too, by creating a setup.py file:

    from distutils.core import setup
    import py2exe
    setup(console=['test.py'])

and then running python setup.py py2exe from the command prompt. That got me the same error. Does anyone have a solution for this problem?

The error is coming from the importlib._bootstrap_external file in py2exe (specifically, the FileLoader function which is passed a path variable but I can't seem to figure out where the path variable is initialized or where it's passed from.

Thank you in advance for your help!

for reference, here's my test.py script:

    count = 0
    while count < 10:
        print("Count = ",count)
        count += 1
Josh Smith

I figured out the problem!

I had installed the newest version of Anaconda on the new Microsoft Surface that I got, not realizing that it was python 3.5 specific. The reason this matters is because distutils for python 3.5 will try and look for 3.5-related items in py2exe even if py2exe is 3.4 specific.

I uninstalled v.3.5 and installed v3.4 (I didn't want to deal with having multiple versions of python installed). Once it was re-installed, I turned off my antivirus and used pip install py2exe. I got a warning that it's an older version of pip but it still worked.

Hopefully this helps anyone else who might have the same issue I had.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related