提供NumPy site.cfg参数给pip [英] Supplying NumPy site.cfg arguments to pip
问题描述
我正在使用针对英特尔数学内核库构建的NumPy.我使用virtualenv,通常使用pip来安装软件包.
I'm using NumPy built against Intel's Math Kernel Library. I use virtualenv, and typically use pip to install packages.
但是,为了让NumPy找到MKL库,有必要在NumPy源目录中创建site.cfg文件,然后再对其进行编译,然后手动进行构建和安装.我可以编写整个过程的脚本,但是我希望有一个更简单的解决方案.
However, in order for NumPy to find the MKL libraries, it's necessary to create a site.cfg file in the NumPy source directory prior to compiling it, then manually build and install. I could script this whole process, but I was hoping for a simpler solution.
我有一个标准的site.cfg文件,可在版本控制下用于此目的.是否有任何pip命令行选项会告诉它在构建软件包之前将特定文件复制到源目录?
I have a standard site.cfg file that can be used for this purpose under version control. Are there any pip command line options that will tell it to copy a particular file to the source directory before building a package?
或者,是否可以设置任何环境变量,而不是在site.cfg文件中提供库路径?这是我使用的site.cfg文件.它几乎是从英特尔网站中直接获得的. >
Alternatively, are there any environment variables that can be set instead of supplying the library paths in a site.cfg file? Here is the site.cfg file that I use. It was taken almost verbatim from Intel's site.
[mkl]
library_dirs = /opt/intel/composer_xe_2013.1.117/mkl/lib/intel64
include_dirs = /opt/intel/composer_xe_2013.1.117/mkl/include
mkl_libs = mkl_rt
lapack_libs =
作为参考,我正在运行Ubuntu,Python 2.7和NumPy 1.6.
For reference, I'm running Ubuntu, Python 2.7, and NumPy 1.6.
推荐答案
从源代码( https://github.com/numpy/numpy/blob/master/site.cfg.example ):
为帮助自动安装(如用户的主目录easy_install) 还将检查文件〜/.numpy-site.cfg.
To assist automatic installation like easy_install, the user's home directory will also be checked for the file ~/.numpy-site.cfg .
这是可行的解决方案吗?您仍然需要使用全局.numpy-site.cfg预加载主目录,但是之后不必再进行构建或安装了.
Is that a workable solution? You'd still need to preload the home directories with the global .numpy-site.cfg, but you wouldn't have to muck with the build or installation after that.
这篇关于提供NumPy site.cfg参数给pip的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!