一骑绝尘

一身转战三千里,一剑曾百万师。这篇文章主要讲述virtualenvwrapper在macos 10.13.6中的使用相关的知识,希望能为你提供帮助。
安装虚拟环境参考  https://www.jianshu.com/p/0921fd4d4bca
列出安装的软件
pip list
virtualenv                             15.1.0     
virtualenv-clone                       0.3.0      
virtualenvwrapper                      4.8.2 
创建一个python3的虚拟环境
$mkvirtualenv --python=/usr/local/bin/python3 python_3
Running virtualenv with interpreter /usr/local/bin/python3
Using base prefix ‘/usr/local/Cellar/python/3.7.0/Frameworks/Python.framework/Versions/3.7‘
/Library/Python/2.7/site-packages/virtualenv.py:1039: DeprecationWarning: the imp module is deprecated in favour of importlib; see the module‘s documentation for alternative uses
  import imp
New python executable in /Users/wangjun/.virtualenvs/python_3/bin/python3.7
Also creating executable in /Users/wangjun/.virtualenvs/python_3/bin/python
Installing setuptools, pip, wheel...done.
virtualenvwrapper.user_scripts creating /Users/wangjun/.virtualenvs/python_3/bin/predeactivate
virtualenvwrapper.user_scripts creating /Users/wangjun/.virtualenvs/python_3/bin/postdeactivate
virtualenvwrapper.user_scripts creating /Users/wangjun/.virtualenvs/python_3/bin/preactivate
virtualenvwrapper.user_scripts creating /Users/wangjun/.virtualenvs/python_3/bin/postactivate
virtualenvwrapper.user_scripts creating /Users/wangjun/.virtualenvs/python_3/bin/get_env_details
(python_3) wangjundeMacBook-Pro:~ wangjun$ python3
Python 3.7.0 (default, Sep 18 2018, 18:47:22) 
[Clang 9.1.0 (clang-902.0.39.2)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
> > > import urllib
> > > import urllib.request
> > > urllib.request.urlopen("http://www.baidu.com")
< http.client.HTTPResponse object at 0x105a49ba8>
> > > exit()
显示所有虚拟环境:workon
(python_3) wangjundeMacBook-Pro:~ wangjun$ workon
py2
python_3
(python_3) wangjundeMacBook-Pro:~ wangjun$ 
退出虚拟环境
$ deactivate
激活虚拟环境
workon python_3
(python_3) wangjundeMacBook-Pro:~ wangjun$
删除虚拟环境
$ rmvirtualenv py2
Removing py2...
(python_3) wangjundeMacBook-Pro:~ wangjun$ workon
python_3
【一骑绝尘】 

 


    推荐阅读