searain
searain

Reputation: 3301

virtualenv install packages (activate virtual environment first) vs pipenv install packages (activate virtual environment later)?

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/

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,

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?

Upvotes: 0

Views: 994

Answers (1)

wrgrs
wrgrs

Reputation: 2569

Er, basically yes.

Virtualenvs change the environment in your current shell, which you can undo with deactivate, whereas pipenv shell creates a new shell that you need to exit when you have finished.

Upvotes: 0

Related Questions