python virtual environment virtualenv installation (windows)

virtualenv is a tool for creating a virtual environment in Python. It can create multiple Python environments on the same machine. Each environment is independent of each other and does not interfere with each other.

Python programs usually need to rely on some third-party libraries. Different projects may depend on different libraries, or even different versions. Therefore, using the global Python environment on the same machine may cause dependency conflicts between different projects. Using virtualenv can solve this problem, which can create an independent Python environment, each environment has its own Python interpreter and third-party libraries, which can be upgraded or modified as needed without affecting other environments.

Third-party libraries installed in a virtual environment will only affect the current environment, not other environments or the global Python environment.

Using virtualenv can easily manage the Python environment and avoid dependency conflicts. It is one of the commonly used tools in Python development.

1. Install virtualenv

pip install virtualenv

2. Create a virtual environment (test is the name of the virtual environment to be created)

virtualenv test

3. Start the virtual environment

test\Scripts\activate

 

Exit the virtual environment

deactivate

Guess you like

Origin blog.csdn.net/qq_17111397/article/details/130279385