Install a Python package into a different directory using pip?

后端 未结 16 2624
借酒劲吻你
借酒劲吻你 2020-11-22 05:55

I know the obvious answer is to use virtualenv and virtualenvwrapper, but for various reasons I can\'t/don\'t want to do that.

So how do I modify the command

16条回答
  •  余生分开走
    2020-11-22 06:26

    If you are using brew with python, unfortunately, pip/pip3 ships with very limited options. You do not have --install-option, --target, --user options as mentioned above.

    Note on pip install --user
    The normal pip install --user is disabled for brewed Python. This is because of a bug in distutils, because Homebrew writes a distutils.cfg which sets the package prefix. A possible workaround (which puts executable scripts in ~/Library/Python/./bin) is: python -m pip install --user --install-option="--prefix="

    You might find this line very cumbersome. I suggest use pyenv for management. If you are using

    brew upgrade python python3

    Ironically you are actually downgrade pip functionality.

    (I post this answer, simply because pip in my mac osx does not have --target option, and I have spent hours fixing it)

提交回复
热议问题