virtualenv
We will activate the virtual environment first and then run pip install ... to install packages for virtual environment.
See the document, https://packaging.python.org/guides/installing-using-pip-and-virtual-environments/
source env/bin/activateNow that you’re in your virtual environment you can install packages. Let’s install the excellent Requests library from the Python Package Index (PyPI):
pip install requests
But pipenv is different.
pipenv
As for pipenv, the instruction here, Please explain the usage of Pipfile and Pipfile.lock
Before we activate the virtual environment,
- We could run
pipenv installto install packages in the project folder first. - Then we can run
pipenv shellto activate the virtual environment.
In other words, using virtualenv, we create/activate virtual environment first, and then pip install ... packages in virtual environment. But using pipenv, we use pipenv install ... to install packages in the project folder first and then use pipenv shell to active the environment.
Is this correct?