Python pip install path

The --target switch is the thing you're looking for:
pip install --target=d:\somewhere\other\than\the\default package_name

But you still need to add d:\somewhere\other\than\the\default to PYTHONPATH to actually use them from that location.

-t, --target <dir>
Install packages into <dir>. By default this will not replace existing files/folders in <dir>.
Use --upgrade to replace existing packages in <dir> with new versions.


Upgrade pip if target switch is not available:

On Linux or OS X:

pip install -U pip

On Windows (this works around an issue):

python -m pip install -U pip

 

refer to 

https://stackoverflow.com/questions/2915471/install-a-python-package-into-a-different-directory-using-pip

posted @ 2019-10-31 18:35  天藐水瓶  阅读(732)  评论(0编辑  收藏  举报