1. Pipenv manages the virtual environment

There are many ways to create a virtual environment. Python 3.x has integrated the VirtualEnv feature to create a virtual environment, using commands under the project. This article introduces the new Python virtual environment management tool Pipenv

Pipenv automatically manages the virtual environment and dependency files for you, and provides a series of commands and options to help you implement various dependencies and environment management related operations

1.1 installation pipenv

pip install --user pipenv

1.2 Create a virtual environment

pipenv install

Creating a virtual environment will look for one in that directory by default
.venvDirectory, if not available or default under home directory user
.local/share/virtualenvsIt is recommended to create one under the project first
.venvFolder, and then create the virtual environment

1.3 Enter the virtual environment

pipenv shell

1.4 Exit the virtual environment

The exit or CTRL + d

1.5 Install third-party packages

Pipenv install flask pipenv install django=1.11.18

1.6 Uninstall third-party packages

pipenv uninstall flask

1.7 View installed dependencies

pipenv graph

1.8 Update the upgrade package

pipenv update requests

1.9 Install packages in the development environment

Plus –dev represents a dependency in dev-packages including Pipfile.

pipenv install autopip8 --dev

1.10 Installation via requirements.txt

pipenv install -r requirements.txt

1.11 Generate the requires.txt file

pipenv lock -r [--dev] > requirements.txt

1.12 Replace the PIP installation source

PSM PIP install PSM 2: list the source PSM --> pypi https://pypi.python.org/simple/ douban http://pypi.douban.com/simple/ aliyun http://mirrors.aliyun.com/pypi/simple/ Qinghua 3: https://mirrors.tuna.tsinghua.edu.cn/pypi/web/simple/ to view the current use of image source PSM show 4: replace the image source PSM use douban

1.13 The pipfile file and pipfile.lock file

PipfileFiles and
pipfile.lockPipfile is a replacement for the virtual environment that was created to record installation dependencies

Pipfile.lock contains information about your system, the dependencies of all installed packages and their versions, and the Hash validation of all installed packages and their dependencies.

1.14 pipenv in source

Pipenv installation third party package is obtained from PyPI by default, domestic installation is slow, if found that the installation of third party module is slow, you can change to the domestic source, directly modify the URL in the PIPFILE file, recommended Tsinghua source, the above PIP installation source has the URL

1.15 pipenv other commands

Pipenv –help — pipenv –help — pipenv –help — pipenv –help — pipenv –help — pipenv –help — pipenv –help — pipenv –help –help — pipenv –help –help — pipenv –help –help — pipenv –help –help Brew install pipenv brew install pipenv brew install pipenv