本文介绍了点安装自定义包含路径的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试安装库pyleargist.它需要手动安装另一个我已安装的库libfftw3.由于我没有root特权,因此必须在主目录~/usr/include~/usr/lib下安装libfftw3.然后,我关注这篇文章: https://superuser.com/questions/242190/如何在OS-x上安装matplotlib

I'm trying to install a library pyleargist. It requires another lib libfftw3 to be manually installed which I've installed. Since I don't have the root privilege, I have to install libfftw3 under my home directory: ~/usr/include and ~/usr/lib. Then I follow this post: https://superuser.com/questions/242190/how-to-install-matplotlib-on-os-x, added:

export LDFLAGS="-L~/usr/lib"
export CFLAGS="-I~/usr/include

pip知道必须参考/usr才能获取include( .h文件)和lib( .a,*.so文件).但是,在运行pip install --user pyleargist时,它抱怨:

So that pip knows it have to consult /usr to get the include (.h files) and lib (.a, *.so files). However, while running pip install --user pyleargist, it complains about:

gcc-4.4.real: src/leargist.c: No such file or directory
gcc-4.4.real: no input files
error: command 'gcc' failed with exit status 1

我猜发生了什么事,因为路径不正确,因此找不到*.c文件(我认为pip应该已经将文件下载到了某个地方,但不确定该文件在哪里).

I guess what happened is that the path is incorrect so that it can't find the *.c files (I think pip should have downloaded the file somewhere but not sure where it is).

所以我的问题如下:1)在这种特殊情况下,如何在~/usr下的includelib路径下安装pyleargist? 2)更一般的说,如果没有在默认路径中找到pip,如何为pip提供附加路径,以便它知道从何处获取附加的包含文件或库?

So my questions are the following: 1) in this particular case, how can I install pyleargist with include and lib path under ~/usr? 2) more generally, how can one provide additional path for pip so that it knows where to get the additional include files or libs if not found in the default path?

p.s我在没有sudo特权的ubuntu机器上.

p.s I am on an ubuntu machine without sudo privilege.

ref:
https://pypi.python.org/pypi/pyleargist/1.0.1
http://www.fftw.org/

ref:
https://pypi.python.org/pypi/pyleargist/1.0.1
http://www.fftw.org/

推荐答案

pip具有--global-option标志

您可以使用它将其他标志传递给build_ext.

You can use it to pass additional flags to build_ext.

例如,添加-I标志:

pip install --global-option=build_ext --global-option="-I/home/users/abc/include/" pyOpenSSL

这篇关于点安装自定义包含路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-05 23:49