Home > Article > Backend Development > What is the pipenv environment?
The pipenv environment is a virtual environment. It can automatically create and manage a virtual environment for the project, add or delete packages from the Pipfile file, and generate a Pipfile.lock file to lock the version and dependency information of the installation package to avoid build errors. Environment installation steps: 1. Make sure pipenv has been installed; 2. Create a new project folder and enter the folder; 3. Run "pipenv --three" in the project folder; 4. Run the "pipenv shell" command Activate virtual environments, etc.
Operating system for this tutorial: Windows 10 system, Python version 3.11.4, Dell G3 computer.
Pipenv is a virtual environment management tool officially recommended by Python. It can be regarded as a collection of virtualenv, pip, and pyenv, similar to npm and composer. It can automatically create and manage virtual environments for projects, add or delete packages from Pipfile files, and generate Pipfile.lock files to lock the version and dependency information of installation packages to avoid build errors.
The installation steps for the pipenv environment are as follows:
Make sure pipenv is installed. If it is not installed, you can install it by running pip install pipenv.
Create a new project folder and go into that folder.
Run pipenv --three in the project folder, which will create an environment using the Python3 of the current system.
If you need to use a specific Python version, you can edit the Pipfile file and replace url="https://pypi.org/simple" with the domestic mirror url="https:/ /pypi.tuna.tsinghua.edu.cn/simple/".
Activate the virtual environment. You can enter the virtual environment by running the pipenv shell command.
In a virtual environment, you can install packages by running pipenv install
You can run pipenv list to see which packages are in the virtual environment.
If you need to exit the virtual environment, you can do so by running the exit command.
After completing the above steps, you will successfully install and use the pipenv environment.
The above is the detailed content of What is the pipenv environment?. For more information, please follow other related articles on the PHP Chinese website!