以下示例演示了使用pip安裝virtual,並創建虛擬環境VMware-Python-sdk,切換至虛擬環境,退出虛擬環境python
[root@shansibleqa ~]# pip install virtualenv DEPRECATION: 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-support Collecting 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: virtualenv Successfully installed virtualenv-16.7.8 [root@shansibleqa ~]# virtualenv /opt/vmware-python-sdk No LICENSE.txt / LICENSE found in source New python executable in /opt/vmware-python-sdk/bin/python2 Also creating executable in /opt/vmware-python-sdk/bin/python Installing 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