virtualenv

$ mkdir myproject
$ cd myproject
$ python3 -m venv venv
New python executable in venv/bin/python
Installing setuptools, pip............done.

Now, whenever you want to work on a project, you only have to activate the corresponding environment. On OS X and Linux, do the following:

$ . venv/bin/activate

Windows:

$ venvscriptsactivate

And if you want to go back to the real world, use the following command:

$ deactivate
原文地址:https://www.cnblogs.com/sufei-duoduo/p/5999366.html