Python的虚拟环境的安装与配置(virtualenv)
- win+r 打开cmd
- pip install virtualenv
- 如下():
Microsoft Windows [版本 10.0.16299.492]
(c) 2017 Microsoft Corporation。保留所有权利。
C:\Users\Administrator>pip install virtualenv
Requirement already satisfied: virtualenv in c:\anaconda3\lib\site-packages (16.0.0)
notebook 5.4.0 requires ipykernel, which is not installed.
jupyter 1.0.0 requires ipykernel, which is not installed.
jupyter-console 5.2.0 requires ipykernel, which is not installed.
ipywidgets 7.1.1 requires ipykernel>=4.5.1, which is not installed.
C:\Users\Administrator>
安装虚拟环境管理包(https://blog.csdn.net/leafage_m/article/details/72854559):
详细方法(https://blog.csdn.net/shaququ/article/details/54292043)
pip install virtualenvwrapper win
如下:
C:\Users\Administrator>pip install virtualenvwrapper win
Requirement already satisfied: virtualenvwrapper in c:\anaconda3\lib\site-packages (4.8.2)
Collecting win
Could not find a version that satisfies the requirement win (from versions: )
No matching distribution found for win
C:\Users\Administrator>
- 修改虚拟环境默认的创建的目录如下图:
新建如下图:
然后确定保存,
然后如下:
C:\Users\Administrator>workon
Pass a name to activate one of the following virtualenvs:
==============================================================================
blogproject_env
mxonline
python2
python3
C:\Users\Administrator>
创建虚拟环境
- 创建一个py3scrapy虚拟环境
C:\Users\Administrator>mkvirtualenv py3scrapy
Using base prefix 'c:\\anaconda3'
New python executable in E:\Evns\py3scrapy\Scripts\python.exe
Installing setuptools, pip, wheel...done.
(py3scrapy) C:\Users\Administrator>
然后在E:\Evns目录能看到所创建的虚拟环境: