1.Windows 安装virtualenv
系统环境:(windows10 家庭版+Python3.8)
安装依赖包
pip(3) install virtualenv
![image-20200913155221803](/themes/hexo-theme-matery/source/medias/plane_loading.gif)
切换路径
PS C:\Users\Mr风语恺撒> cd D:
PS D:\> mkdir aivirtualenv
PS D:\> cd aivirtualenv
生成虚拟环境
virtualenv pythondemo
![image-20200913155848544](/themes/hexo-theme-matery/source/medias/plane_loading.gif)
激活虚拟环境
PS D:\aivirtualenv> cd pythondemo
PS D:\aivirtualenv\pythondemo> dir
PS D:\aivirtualenv\pythondemo> cd Scripts
PS D:\aivirtualenv\pythondemo\Scripts> activate(或 .\activate)
![image-20200913155912242](/themes/hexo-theme-matery/source/medias/plane_loading.gif)
![image-20200913160052113](/themes/hexo-theme-matery/source/medias/plane_loading.gif)
退出虚拟环境
deactivate
![image-20200913160437541](/themes/hexo-theme-matery/source/medias/plane_loading.gif)
2.virtualenv中的配置
2.1安装pip工具
python -m ensurepip
python -m pip install --upgrade pip
![image-20200913165648122](/themes/hexo-theme-matery/source/medias/plane_loading.gif)
2.2安装jupyter
pip install jupyter
![image-20200913172357364](/themes/hexo-theme-matery/source/medias/plane_loading.gif)
2.2.1jupyter的启动
jupyter notebook
之后进入浏览器中使用即可
![image-20200913191520587](/themes/hexo-theme-matery/source/medias/plane_loading.gif)
![image-20200913190826420](/themes/hexo-theme-matery/source/medias/plane_loading.gif)
2.2.2 jupyter更改默认工作目录位置
2.3安装numpy
pip install numpy
![image-20200913192837393](/themes/hexo-theme-matery/source/medias/plane_loading.gif)
3.使用Anaconda安装管理多版本Python环境
3.1验证anaconda是否安装成功
conda --version
3.2 接着创建名为<env_name>的环境(指定Python版本)
conda create -n <env_name> python=3.7
3.3 激活进入环境
conda activate -n <env_name>
3.4 在环境里可用 pip或conda install 当前环境所需要的包,如:
pip install tensorflow==2.3
3.5查看当前环境中以安装的包
conda list
3.6 更新包
pip install -U packagename
3.7 指定下载镜像源
默认
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
conda config --set show_channel_urls yes
个别包
使用
pip install packagename -i url(下载源)
安装多个包用空格间开即可
3.5 退出当前环境
deactivate(或 conda deactivate)
![image-20201021153534206](/themes/hexo-theme-matery/source/medias/plane_loading.gif)