如下示例演示了使用pip安装virtual,并建立虚拟环境VMware-Python-sdk,切换至虚拟环境,退出虚拟环境

[root@shansibleqa ~]# pip install virtualenvDEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-supportCollecting virtualenv Downloading https://files.pythonhosted.org/packages/62/77/6a86ef945ad39aae34aed4cc1ae4a2f941b9870917a974ed7c5b6f137188/virtualenv-16.7.8-py2.py3-none-any.whl (3.4MB) |████████████████████████████████| 3.4MB 22kB/s Installing collected packages: virtualenvSuccessfully installed virtualenv-16.7.8 [root@shansibleqa ~]# virtualenv /opt/vmware-python-sdk No LICENSE.txt / LICENSE found in sourceNew python executable in /opt/vmware-python-sdk/bin/python2Also creating executable in /opt/vmware-python-sdk/bin/pythonInstalling setuptools, pip, wheel...done.[root@shansibleqa ~]# source /opt/vmware-python-sdk/bin/activate(vmware-python-sdk) [root@shansibleqa ~]# (vmware-python-sdk) [root@shansibleqa ~]# (vmware-python-sdk) [root@shansibleqa ~]# deactivate