向 pip 提供 NumPy site.cfg 参数 [英] Supplying NumPy site.cfg arguments to pip

查看:21
本文介绍了向 pip 提供 NumPy site.cfg 参数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的是针对英特尔 Math Kernel 库构建的 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.

这篇关于向 pip 提供 NumPy site.cfg 参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆