Using virtualenv to build a Python + Flask Development Environment on Windows, virtualenvflask
About virtualenv:
VirtualEnv is used to create multiple independent Python virtual runtime environments on a machine. Multiple Python environments are independent of each other and do not affect each other. It can:
1. Install the new suite without permission
2. Different Application versions can be used.
3. Kit upgrade does not affect other applications
The virtual environment is a private copy on the Python interpreter. you can install packages in an isolated environment without affecting the global Python interpreter in your system.
The virtual environment is very useful because it can prevent system packet management confusion and version conflicts. Creating a virtual environment for each application ensures that the application can only access the packages they use, so that the global interpreter serves only as a source and is still clean and tidy to more virtual environments. Another benefit is that the virtual environment does not require administrator permissions.
Install Python 2.7
Visit https://www.python.org/to download the python 2.7 series WINDOWS version.
After installation, add the Python-related PATH to the PATH environment variable (for example, install it in D: \ Python27 ):
D:\Python27D:\Python27\Scripts
Install setuptools (easy_install)
wget https://bitbucket.org/pypa/setuptools/raw/bootstrap/ez_setup.pypython ez_setup.py
Install virtualenv
Run the easy_install command to install virtualenv:
easy_install virtualenv
Create a virtual environment
Pure virtual environment:
virtualenv.exe venv
Applicable to scenarios where all software packages use The PY software package.
Hybrid Virtual Environment:
virtualenv --system-site-packages venv
It is applicable to scenarios where some special software packages are available, because a specific software package cannot be directly installed through pip in the absence of a compilation environment.
Activate the virtual environment:
venv\Scripts\activate.bat
Exit the virtual environment:
venv\Scripts\deactivate.bat
Install software package
After activating the virtual environment, run the pip command to install the software package:
pip install package
Replace package with the package name.
Software packages include pure Python software packages and special software packages.
A pure Python package is a software package written in Python. You only need to run the pip install command to complete the installation without compiling the environment.
A special Software Package refers to a majority of software packages that are written using PY, some specific parts are written using C language, and must be compiled before they can be used. It cannot be directly installed using pip install and must be supported by the compiling environment. For example, Mysql-Python (MySQLDb) and pycrypto. A special software package usually has a compiled version for WINDOWS.
Install Flask
virtualenv.exe venvvenv\Scripts\activate.batpip install flask