赞
踩
1.官网安装anaconda.Anaconda的安装和详细介绍(带图文)
2.默认选项安装,记住安装路径
3.编辑系统环境变量-Path-编辑文本
在后面加入anaconda的路径:
D:\xxxx\anaconda;D:\xxxx\anaconda\Scripts;D:\xxxx\anaconda\Library\bin;D:\xxxx\anaconda\Library\mingw-w64\bin;
确定(注意关闭360杀毒等软件,可能导致无法改变环境变量的情况)
4.win+R-cmd-进入命令行:
conda --version 测试是否成功
conda create -n learn python=3 创建一个名称为learn的虚拟环境并指定python版本为3(这里conda会自动找3中最新的版本下载)
activate learn 切换到learn虚拟环境
conda env list 列出conda管理的所有环境
conda list --列出当前环境的所有包
conda install requests 安装requests包
conda remove requests 卸载requets包
conda remove -n learn --all 删除learn环境及下属所有包
conda update requests 更新requests包
conda env export > environment.yaml 导出当前环境的包信息
conda env create -f environment.yaml 用配置文件创建新的虚拟环境
5.pycharm配置
Setting => Project => Project Interpreter 里面修改 Project Interpreter , 点击齿轮标志再点击Add Local为你某个环境的python.exe解释器就行了
环境路径:conda env list
例:C:\Users\xxxx\.conda\envs\learn\python.exe
6.修改下载源
#恢复默认镜像源 conda config --remove-key channels
添加腾讯源
conda config --add channels https://mirrors.cloud.tencent.com/anaconda/pkgs/free/
conda config --add channels https://mirrors.cloud.tencent.com/anaconda/pkgs/main/
conda config --add channels https://mirrors.cloud.tencent.com/anaconda/cloud/conda-forge/
conda config --add channels https://mirrors.cloud.tencent.com/anaconda/cloud/pytorch/
conda config --add channels https://mirrors.cloud.tencent.com/anaconda/pkgs/pro/
添加清华源
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.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/
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/pro/
移除腾讯源
conda config --remove channels https://mirrors.cloud.tencent.com/anaconda/pkgs/free/
conda config --remove channels https://mirrors.cloud.tencent.com/anaconda/pkgs/main/
conda config --remove channels https://mirrors.cloud.tencent.com/anaconda/cloud/conda-forge/
conda config --remove channels https://mirrors.cloud.tencent.com/anaconda/cloud/pytorch/
conda config --remove channels https://mirrors.cloud.tencent.com/anaconda/pkgs/pro/
移除清华源
conda config --remove channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
conda config --remove channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/
conda config --remove channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/
conda config --remove channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch/
conda config --remove channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/pro/
7.安装库(机器学习为例)
panda, snumpy, scipy, matplotlib, statsmodels, scikit-learn anaconda本来就有的,但是虚拟环境需要自己安装,用"conda install 安装包名"即可下载.
pyflux安装:直接conda install pyflux报错
失败方法:conda install -c MZH PyFlux
失败原因:里面就不包含pyflux
解决成功:https://www.lfd.uci.edu/~gohlke/pythonlibs/,进去后ctrl+f搜索pyflux,下载pyflux-0.4.17-cp39-cp39-win_amd64.whl存放至D:\xxxx\anaconda\envs\learn\Scripts\下
再次在命令行运行 pip install D:\xxxx\anaconda\envs\learn\Scripts\pyflux-0.4.17-cp39-cp39-win_amd64.whl
错误:
ERROR: Could not find a version that satisfies the requirement numdifftools (from pyflux) (from versions: none)
ERROR: No matching distribution found for numdifftools
原因:网不好,再次执行ok
fbprophet安装:依赖pystan,先安装好pystan,就可以正常安装了
pystan安装:
错误:
CondaError: Downloaded bytes did not match Content-Length
原因:没有用清华源,安装超时了,按照上面修改下载源就好了
我的改变源已成功。
还有改变源仍然不成功的方法:CondaError: Downloaded bytes did not match Content-Length
在安装pytorch的时候安装到半路,显示CondaError: Downloaded bytes did not match Content-Length。网上的解决方法是添加清华源的镜像,但我的已经是清华源镜像了,所以解决方法是把timeout放大,600还是不行,把时间延长到1000.0就成功安装了。命令如下:
conda config --set remote_read_timeout_secs 1000.0
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。