繁体   English   中英

Py2Exe,[Errno 2]没有这样的文件或目录:'numpy-atlas.dll'

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

我在我的程序中包含了matplotlib,我搜索了谷歌上的numpy_atlas.dll,我似乎是地球上唯一一个有这个问题的人。

setup.py

from setuptools import setup
import py2exe

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

运行Py2Exe会导致错误

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'

这对我有用。 我找到了DLL:C:\\ Python27 \\ Lib \\ site-packages \\ numpy \\ core \\ numpy-atlas.dll并将其复制到具有setup.py的同一文件夹中

我遇到了同样的问题。 经过一些测试后,将numpy.core目录附加到sys.path似乎可行。

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(...)

听起来像py2exe找不到DLL。 以下脚本将使py2exe安静:

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

您仍然需要确保dll在用户的计算机上。 我相信numpy-atlas.dll是matplot依赖项之一。

如果其他一切都失败了,还要考虑使用PyInstaller。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM