Home >Backend Development >Python Tutorial >What is the pipenv environment?

What is the pipenv environment?

DDD
DDDOriginal
2023-11-24 13:56:38809browse

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.

What is the pipenv environment?

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:

  1. Make sure pipenv is installed. If it is not installed, you can install it by running pip install pipenv.

  2. Create a new project folder and go into that folder.

  3. Run pipenv --three in the project folder, which will create an environment using the Python3 of the current system.

  4. 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/".

  5. Activate the virtual environment. You can enter the virtual environment by running the pipenv shell command.

  6. In a virtual environment, you can install packages by running pipenv install and uninstall packages by running pipenv uninstall .

  7. You can run pipenv list to see which packages are in the virtual environment.

  8. 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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Related articles

See more