pip install customized include path

前端 未结 3 758
梦如初夏
梦如初夏 2021-02-07 06:50

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 r

相关标签:
3条回答
  • 2021-02-07 07:19

    pip has a --global-option flag

    You can use it to pass additional flags to build_ext.

    For instance, to add a -I flag:

    pip install --global-option=build_ext --global-option="-I/home/users/abc/include/" pyOpenSSL
    
    0 讨论(0)
  • 2021-02-07 07:24

    if you dont have root you can get a virtual enviroment no root is needed to get one and your path will be in home

    curl -O https://pypi.python.org/packages/source/v/virtualenv/virtualenv-1.10.1.tar.gz
    tar xvfz virtualenv-1.10.1.tar.gz
    cd virtualenv-1.10.1.tar.gz
    python virtualenv.py myVE
    

    then your path is set in your home:

    cd myVE/bin
    ./python
    
    >>> import sys
    >>> sys.path
    ['', '/home/foobar/temp/virtualenv-1.10.1/myVE/lib/python33.zip', '/home/foobar/temp/virtualenv-1.10.1/myVE/lib/python3.3', '/home/foobar/temp/virtualenv-1.10.1/myVE/lib/python3.3/plat-linux', '/home/foobar/temp/virtualenv-1.10.1/myVE/lib/python3.3/lib-dynload', '/usr/lib64/python3.3', '/usr/lib/python3.3', '/usr/lib/python3.3/plat-linux', '/home/foobar/temp/virtualenv-1.10.1/myVE/lib/python3.3/site-packages']
    >>> 
    
    0 讨论(0)
  • 2021-02-07 07:25

    This was a helpful thread. Just to add on to this, you can also use pip without root if you pass the --user flag at the end:

    pip install --global-option="-I/home/users/abc/include/" mpi4py --user
    

    For example, if you're using python-v2.7, the above command installs the python package to /home/username/.local/lib/python2.7/site-packages

    0 讨论(0)
提交回复
热议问题