Installing pip packages to $HOME folder?

Installing pip packages to $HOME folder?

Asked on November 9, 2018 in Python.
Add Comment


  • 3 Answer(s)

      It is better to use virtualenv at your HOME directory:

    $ sudo easy_install -U virtualenv
    $ cd ~
    $ virtualenv .
    $ bin/pip ...
    

      then conjointly alter ~/.(login|profile|bash_profile), whichever is true for the shell to feature ~/bin to the PATH and so that pip|python|easy_install would be the one utilized.

    Answered on November 9, 2018.
    Add Comment

       While using a virtualenv, There is no need to this. The trick is passing the PEP370 —userargument to the setup.py script. With the newest version of pip, a way to try and do it is:

    pip install --user mercurial
    

       This should end in the hg script being put in in $HOME/.local/bin/hg and therefore the remainder of the hg package in $HOME/.local/lib/pythonx.y/site-packages/.

       Note, that the on top of is true for Python a pair of.6. There has been a small amount of disceptation among the Python core developers regarding what’s the acceptable directory location on mack OS X for PEP370-style user installations. In Python a pair of.7 and 3.2, the situation on mack OS X was modified from $HOME/.local to $HOME/Library/Python.

       This may amendment during a future unharness. But, for now, on 2.7 (and 3.2, if hg were supported on Python 3), the on top of locations are $HOME/Library/Python/x.y/bin/hg and $HOME/Library/Python/x.y/lib/python/site-packages.

    Answered on November 9, 2018.
    Add Comment

    Specify the -t choice (–target) to specify the destination directory is possible . See pip install –help for elaborate info. this can be the command you need:

    pip install -t path_to_your_home package-name
    
    

    For example, for putting in say mxnet, in my $HOME directory, I type:
    pip install -t /home/foivos/ mxnet
    
    

    Answered on November 9, 2018.
    Add Comment


  • Your Answer

    By posting your answer, you agree to the privacy policy and terms of service.