Install a Python package into a different directory using pip?

803    Asked by DavidEDWARDS in Python , Asked on Apr 18, 2021

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

pip install package_name

to make pip install the package somewhere other than the default site-packages?

Answered by David EDWARDS

There are many ways to install a Python package into a different directory using pip some of them are as follows:-

You can use the below-mentioned command for installing a Python package into a different directory:-

  pip install --target=d:somewhereother	han	hedefault package_name

Another way you can use for installing a Python package into a directory is using pip install path:

  pip install --install-option="--prefix=$PREFIX_PATH" package_na



Your Answer

Interviews

Parent Categories