problem
Sometimes the development of different business, the required environment is not the same. Has been developing in the same environment when a different version upgrade package could lead to additional business does not work. In addition, some projects on github different needs of the development environment and you use the environment, in accordance with its temerity requirements
to install the appropriate package will have similar problems.
In general, the view of this situation, different business, and if there is a dependency package version relegation problems, the conventional approach is to create different virtual environments for different services under each business, the first to enter the virtual environment, and then dependencies that need to be re-installed, so it will not produce different versions, or upgrade other business does not work properly due to this problem.
Solution
Mac Os system
Installation pip
Pip, Python installer packet, its official introduction in this document .
In general, when installed python3, pip also will be installed. If you get the following error
1 pip command not found
Use the following command to install pip:
1 sudo easy_install pip
Installation virtualenv
virtualenv is a tool to create isolated python project. Similar to the python and depend on each project packages isolation.
Enter the following command to install
1 sudo pip install virtualenv
If the resulting error, enter the following command to install
1 sudo -H pip install virtualenv
Creating virtualenv environment
Navigate to your code to be stored under the path, create a new directory
1 mkdir my_project && cd my_project
Entered into my_project
to create a new virtual environment virtualenv folder
1 virtualenv env
Once created, the environment needs to be activated virtualenv
1 source env/bin/activate
This will appear in front of the terminal, indicating that the virtual environment is created, and they can operate freely in the virtual environment, will not have an impact on other services
Study and discussion group: 632 408 235
link:
MAC built under virtual environment
PIP and Virtualenv on Mac