virtualenvwrapper在macos 10.13.6中的使用

Posted

一骑绝尘

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了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

 

 

以上是关于virtualenvwrapper在macos 10.13.6中的使用的主要内容,如果未能解决你的问题,请参考以下文章

virtualenvwrappers 踩坑

virtualenvwrapper

virtualenvwrapper安装配置

CentOS7 安装虚拟环境 virtualenvwrapper

windows下安装Virtualenvwrapper

Linux 之 安装虚拟环境virtualenvwrapper