whindows cmd 下创建不同版本python的虚拟环境;
Microsoft Windows [版本 10.0.17763.1577] (c) 2018 Microsoft Corporation。保留所有权利。
首先:安装virtualenv
pip install virtualenv
pip install virtualenvwrapper-win
然后:开始创建虚拟环境
1.查看当着的python版本: C:\Users\Administrator>python Python 3.9.0 (tags/v3.9.0:9cf6752, Oct 5 2020, 15:34:40) [MSC v.1927 64 bit (AMD64)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> ^Z 2.切换到建立python虚拟环境的路径: C:\Users\Administrator>F: F:\>cd F:\0_Work\4_python\python36venv 3.使用命令建立虚拟环境: virtualenv -p "C:\Programs\Python\python36\python.exe" venv36 (virtualenv -p + "python解析器在环境变更中的路径" + "python虚拟环境的名字") F:\0_Work\4_python\python36venv>virtualenv -p C:\Programs\Python\python36\python.exe venv36 created virtual environment CPython3.6.8.final.0-64 in 3209ms creator CPython3Windows(dest=F:\0_Work\4_python\python36venv\venv36, clear=False, no_vcs_ignore=False, global=False) seeder FromAppData(download=False, pip=bundle, setuptools=bundle, wheel=bundle, via=copy, app_data_dir=C:\Users\Administrator\AppData\Local\pypa\virtualenv) added seed packages: pip==20.3.1, setuptools==51.0.0, wheel==0.36.1 activators BashActivator,BatchActivator,FishActivator,PowerShellActivator,PythonActivator,XonshActivator 4.进入建立的虚拟环境: F:\0_Work\4_python\python36venv>cd venv36 F:\0_Work\4_python\python36venv\venv36>dir 驱动器 F 中的卷是 新加卷 卷的序列号是 6E6C-5054 F:\0_Work\4_python\python36venv\venv36 的目录 2020/12/09 18:01 <DIR> . 2020/12/09 18:01 <DIR> .. 2020/12/09 18:01 42 .gitignore 2020/12/09 18:01 <DIR> Lib 2020/12/09 18:01 300 pyvenv.cfg 2020/12/09 18:01 <DIR> Scripts 2 个文件 342 字节 4 个目录 265,085,833,216 可用字节 5.使用新建立的虚拟环境: F:\0_Work\4_python\python36venv\venv36>Scripts\activate.bat 6.查看虚拟环境使用的python版本 (venv36) F:\0_Work\4_python\python36venv\venv36>python Python 3.6.8 (tags/v3.6.8:3c6b436a57, Dec 24 2018, 00:16:47) [MSC v.1916 64 bit (AMD64)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> ^Z 7.退出虚拟环境: (venv36) F:\0_Work\4_python\python36venv\venv36>Scripts\deactivate.bat F:\0_Work\4_python\python36venv\venv36>