python - 如何使用 Pynsist 在 python 中安装 numpy
问题描述
如果我使用 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,我们在 installer.cfg 文件中添加了一个依赖项。依赖项是:anaconda-project。现在可以正确导入 numpy 了。
推荐阅读
- java - 发送蓝色:发送带有附件的邮件到 sendinblue
- android - 如何在没有平面的情况下在相对于相机的相对位置创建对象?
- mysql - 当 SP 的实际代码在 10 分钟内直接执行时,为什么在超时开始之前存储过程永远不会返回?
- java - 项目单击侦听器不适用于自动滚动 Recyclerview
- php - 在为 cpt 创建自定义搜索时需要帮助
- node.js - 如何在 Dialogflow 的承诺中通知用户 POST 失败?
- sql-server - SqlException:“必须声明标量变量”在执行存储过程
- c# - 以前登录有效时,用户“ ”登录失败
- javascript - Cordova 文件插件无法删除文件
- c++ - Tensorflow Lite arm64 错误:无法转换'const int8x8_t?