Py2Exe, [Errno 2] No such file or directory: 'numpy-atlas.dll'

两盒软妹~` 提交于 2019-12-23 07:08:40

问题


I have included matplotlib in my program, I searched about numpy_atlas.dll on google and I seem to be the only one on Earth with this problem.

setup.py

from setuptools import setup
import py2exe

setup(console=['EulerMethod.py'])

Running Py2Exe results in error

C:\(..obmitted..)>python setup.py py2exe
running py2exe
*** searching for required modules ***
*** parsing results ***
......
...obmitted...
......
*** finding dlls needed ***
error: [Errno 2] No such file or directory: 'numpy-atlas.dll'

回答1:


Sounds like py2exe can't find dll. Following script will make py2exe quiet:

distutils.core.setup(
options = {
    "py2exe": {
        "dll_excludes": ["MSVCP90.dll"]
    }
},
...

)

You still need to make sure that dll is on the user's machine. I believe numpy-atlas.dll is one of matplot dependencies.

Also consider using PyInstaller if everything else fails.




回答2:


This is what worked for me. I found the dll: C:\Python27\Lib\site-packages\numpy\core\numpy-atlas.dll and copied it to the same folder that has the setup.py




回答3:


I encountered the same problem. After a little testing, appending numpy.core directory to sys.path seemed to work.

from distutils.core import setup
import py2exe

import numpy
import os
import sys

# add any numpy directory containing a dll file to sys.path
def numpy_dll_paths_fix():
    paths = set()
    np_path = numpy.__path__[0]
    for dirpath, _, filenames in os.walk(np_path):
        for item in filenames:
            if item.endswith('.dll'):
                paths.add(dirpath)

    sys.path.append(*list(paths))

numpy_dll_paths_fix()
setup(...)


来源:https://stackoverflow.com/questions/36191770/py2exe-errno-2-no-such-file-or-directory-numpy-atlas-dll

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!