简体   繁体   English

在Windows中使用批处理文件静默安装numpy.exe

[英]install numpy.exe silently with batch file in windows

I want to create a batch file that helps multiple users install numpy on a Windows shared drive. 我想创建一个批处理文件,帮助多个用户在Windows共享驱动器上安装numpy。 Basically, users should not have to input options or perform any actions at all (as they would if they double-clicked the numpy executable installer). 基本上,用户不必输入选项或执行任何操作(就像他们双击numpy可执行安装程序一样)。

A Python installation is already present . Python安装已经存在 The users have to just run the batch file and install numpy into the default Python\\Lib\\site-packages location. 用户必须只运行批处理文件并将numpy安装到默认的Python\\Lib\\site-packages位置。

I've tried using the following commands: 我尝试过使用以下命令:

numpy-1.6.1-win32-superpack-python2.7.exe /qn
numpy-1.6.1-win32-superpack-python2.7.exe /quiet
numpy-1.6.1-win32-superpack-python2.7.exe /passive

In all cases, the batch file is in the same directory as the executables and a graphical window pops up where the user has to click 'Next' again and again. 在所有情况下,批处理文件与可执行文件位于同一目录中,并弹出一个图形窗口,用户必须一次又一次地单击“下一步”。 Is there a way to run the install with ALL default options and not have user interaction? 有没有办法使用所有默认选项运行安装而没有用户交互?

It seems like the numpy install process is actually make of two installers. 看起来numpy安装过程实际上是由两个安装程序组成的。 The outer one is NSIS, while the inner is python's distutils installer. 外部是NSIS,而内部是python的distutils安装程序。 All NSIS installers have the /s for silent installs, but this NSIS installer invokes the distutils installer. 所有NSIS安装程序都有/s用于静默安装,但此NSIS安装程序调用distutils安装程序。

Unfortunately, there doesn't seem to be any silent flags for the distutils installer. 不幸的是,distutils安装程序似乎没有任何静默标志。 I see only two obvious options: 我只看到两个明显的选择:

  • compile numpy yourself and make it emit an msi installer (thus, should be able to silently be installed). 自己编译numpy并使其发出一个msi安装程序(因此,应该能够以静默方式安装)。 Use python setup.py bdist_msi . 使用python setup.py bdist_msi If you prefer, you can generate an NSIS package using bdist_nsi . 如果您愿意,可以使用bdist_nsi生成NSIS包。
  • Use something like AutoIt to automate the distutils installer. 使用AutoIt之类的东西来自动化distutils安装程序。 Simply wait for the disutils window to appear & send it a series of keyboard shortcuts to automate the install. 只需等待disutils窗口出现并发送一系列键盘快捷键即可自动安装。

The latter seems like the more practical solution. 后者似乎是更实际的解决方案。 You could also try to get the python devs to get a silent flag into the distutils installer... 您还可以尝试让python开发人员在distutils安装程序中获得一个静默标志...

No need to install this from source if you have the correct .exe package. 如果你有正确的.exe包,则无需从源代码安装。

I grabbed that latest numpy .exe from http://www.lfd.uci.edu/~gohlke/pythonlibs/#numpy 我从http://www.lfd.uci.edu/~gohlke/pythonlibs/#numpy抓起了最新的numpy .exe文件

and working from the downloads folder you just type this in the console: 并从downloads文件夹中工作,您只需在控制台中键入:

easy_install c:\users\YourName\downloads\numpy‑MKL‑1.9.1.win32‑py2.7.exe

我用来安装无人值守的方法如下:

%PYTHON_PATH%\Scripts\easy_install c:\temp\numpy-1.9.0.zip

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

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