A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://pip.readthedocs.io/en/stable/installing/../topics/python-option/ below:

Managing a different Python interpreter

Toggle table of contents sidebar

Managing a different Python interpreterΒΆ

Added in version 22.3.

Occasionally, you may want to use pip to manage a Python installation other than the one pip is installed into. In this case, you can use the --python option to specify the interpreter you want to manage. This option can take one of two values:

  1. The path to a Python executable.

  2. The path to a virtual environment.

In both cases, pip will run exactly as if it had been invoked from that Python environment.

One example of where this might be useful is to manage a virtual environment that does not have pip installed.

Linux
$ python -m venv .venv --without-pip
$ python -m pip --python .venv install SomePackage
[...]
Successfully installed SomePackage
MacOS
$ python -m venv .venv --without-pip
$ python -m pip --python .venv install SomePackage
[...]
Successfully installed SomePackage
Windows
C:> py -m venv .venv --without-pip
C:> py -m pip --python .venv install SomePackage
[...]
Successfully installed SomePackage

You could also use --python .venv/bin/python (or on Windows, --python .venv\Scripts\python.exe) if you wanted to be explicit, but the virtual environment name is shorter and works exactly the same.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4