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

2024-04-29 17:15:30 发布

您现在位置:Python中文网/ 问答频道 /正文

我把matplotlib包含在我的程序中,我在google上搜索了关于numpy-atlas.dll的信息,我似乎是地球上唯一有这个问题的人。

安装程序.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'

Tags: frompyimport程序numpy信息地球matplotlib
3条回答

我遇到了同样的问题。经过一些测试后,将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。

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

相关问题 更多 >