How can I install python packages in a virtual environment?

54 views Asked by At

I am trying to use virtualenv. I used this command to install the package: pip install virtualenv Then I create a folder using this command: python -m venv venv Now I want to use django package in this environment. What should should do? I got this error message: Could not install packages due to an OSError: HTTPSConnectionPool ...

how to install any package in virtualenv

2

There are 2 answers

1
Aviraj Kumar On BEST ANSWER

You can activate virtual environment: on windows use venv\scripts\activate

Or on Unix or Mac you can use source venv\bin\activate

Then install django

and if You are getting error message OSError: HTTPSConnectionPool Then it might be due to your internet connectivity problem. Or You can try to upgrade pip by pip install --upgrade pip

0
Sowmya On

First activate the virtual environment

source venv/bin/activate

Then you can install packages using pip install