anaconda环境:
opencv配置:
1、anaconda prompt下打开环境或者创建环境(输入conda create -n 环境名 指定python的版本)
如conda create -n pytorch python=3.6
2、激活环境,以后每次对环境进行操作都要激活环境
输入conda activate 环境名 或 activate 环境名
3、执行opencv安装
pip install opencv-python -i http://pypi.douban.com/simple/ --trusted-host pypi.douban.com
pip install opencv-contrib-python -i https://pypi.tuna.tsinghua.edu.cn/simple
4、关闭环境
视频链接:https://www.bilibili.com/video/BV1qo4y1Z76S
tensorflow配置:
anaconda prompt下输入
conda create -n tf tensorflow
tensorflow包也可以在pycharm环境设置里导入
视频链接:https://www.bilibili.com/video/BV1Kh411d7Rx
pytorch配置:
1、2步同 opencv配置
3、官网选择指令,然后
(1)、首先是添加清华镜像channel
conda config --add channels http://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/win-64/
conda config --add channels http://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/win-64/
conda config --add channels http://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch/win-64/
conda config --set show_channel_urls yes
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/
conda config --add channels https://mirrors.bfsu.edu.cn/anaconda/pkgs/free/
conda config --add channels https://mirrors.bfsu.edu.cn/anaconda/pkgs/main/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/msys2/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/bioconda/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/menpo/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/fastai/
# 设置搜索时显示通道地址 从channel中安装包时显示channel的url,这样就可以知道包的安装来源
conda config --set show_channel_urls yes
(2)、安装的指令,主要是把官网指令后面的-c pytorch删掉,-c pytorch,意思是 安装下载的channel强制为pytorch官网的channel。所以需要删除才能走清华镜像的channel
视频链接:https://www.bilibili.com/video/BV1hE411t7RN
anaconda环境中安装各种包:anaconda prompt命令行或者pycharm的terminal中执行pip install 名称
注:
如果不用anaconda环境,则只需在windows命令行或者pycharm的terminal中执行pip install 名称
解决pip下载慢的方法:采用国内镜像
阿里云 http://mirrors.aliyun.com/pypi/simple/
中国科技大学 https://pypi.mirrors.ustc.edu.cn/simple/
豆瓣 http://pypi.douban.com/simple/
清华大学 https://pypi.tuna.tsinghua.edu.cn/simple/
中国科学技术大学 http://pypi.mirrors.ustc.edu.cn/simple/
华中理工大学 http://pypi.hustunique.com/
山东理工大学 http://pypi.sdutlinux.org/
命令如下:
pip install (需要下载的东西,如 tensorboard,opencv-python,tensorflow等) -i https://pypi.tuna.tsinghua.edu.cn/simple/
pip install (需要下载的东西,如 tensorboard,opencv-python,tensorflow等) -i https://pypi.tuna.tsinghua.edu.cn/simple/
注意后面要有/simple目录!!!