Ask Your Question
1

How can one install packages globally in a virtual environment?

asked 2023-05-25 03:20:47 +0000

lalupa gravatar image

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
3

answered 2023-05-25 03:47:02 +0000

devzero gravatar image

It is generally not recommended to install packages globally in a virtual environment as it defeats the purpose of creating a separate environment with unique dependencies. However, if you really want to install packages globally in a virtual environment, you can do so by activating the virtual environment and using the system's package manager (e.g. apt for Ubuntu):

  1. Activate the virtual environment:
source path/to/venv/bin/activate
  1. Install the package using the system's package manager:
sudo apt install package-name

This will install the package globally on the system, but it will be available in the virtual environment as well since it is activated. However, it is recommended to use the virtual environment's package manager (e.g. pip) to install packages within the virtual environment.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss

Add Answer


Question Tools

Stats

Asked: 2023-05-25 03:20:47 +0000

Seen: 13 times

Last updated: May 25 '23