【问题标题】:How to install numpy in python with Pynsist如何使用 Pynsist 在 python 中安装 numpy
【发布时间】:2018-06-09 17:20:48
【问题描述】:

如果我使用 Pynsist 包构建了一个应用程序,然后在安装该应用程序之后,我将在应用程序路径的 pkg 文件夹中有一个 numpy 包,就像我在 installer.cfg 中提到的一样。 但是Python 2.7的站点包中不会有任何numpy(由于NSIS构建应用程序下载的python安装程序而安装。

那么,python 是如何知道计算机中是否有 numpy 的呢? 换句话说,应用程序文件夹中的 numpy 包将如何将自身链接到 Python lib/site-package 文件夹?我们需要将该文件夹复制到站点包位置还是我遗漏了什么?

下面是installer.cfg代码

[Application]
name=FaceLock
version=1.0
# How to launch the app - this calls the 'main' function from the 'myapp' package:
entry_point=openApplication:self


[Python]
version=2.7.14



[Include]
# Packages from PyPI that your application requires, one per line
# These must have wheels on PyPI:
pypi_wheels=opencv-contrib-python==3.4.1.15
            numpy==1.14.0


# To bundle packages which don't publish wheels, see the docs on the
# config file.
packages=cv2
        PIL
        Tkinter
        glob



# Other files and folders that should be installed
files=detector.py
        dataSetGenerator.py
        trainData.py
        storeDictionary.py
        CheckFace.py
        CheckFace.py
        Classifiers/
        trainer/
        Trying/

【问题讨论】:

  • Numpy 不需要复制/链接到站点包。 Pynsist 安装的应用程序将其 pkgs 目录添加到它寻找导入的位置列表中,代码如下:github.com/takluyver/pynsist/blob/…
  • 谢谢。是的你是对的。 pkgs 文件夹将是查找 numpy 的地方。当我将 anaconda-project 依赖项添加到 installer.cfg 时,我现在一切正常。现在我没有遇到任何与 numpy.array.multicore 相关的问题

标签: python numpy opencv nsis pynsist


【解决方案1】:

在这里,为了让应用程序知道也必须导入 numpy,我们在 installer.cfg 文件中添加了一个依赖项。依赖项是:anaconda-project。 现在numpy可以正常导入了。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2015-09-16
    • 2020-01-12
    • 2013-09-18
    • 2017-04-15
    • 2012-04-20
    • 2014-06-15
    • 2013-05-09
    • 1970-01-01
    相关资源
    最近更新 更多