根据别人提供的.yaml文件复现环境时,使用
conda env create -f environment.yaml
就可以复现安装环境了。移植过来的环境只是安装了你原来环境里用conda install等命令直接安装的包,你用pip之类装的东西没有移植过来,需要你重新安装。
.yaml中各个名字的含义
name:生成的环境的名字
channels:频道(可选),参考频道下载包。 conda-forge 上的软件包可能比默认频道上的软件包更新。(去这里寻找需要安装的包、库)
dependencies
:依赖项,例如您希望在创建环境时预安装的库。
name: env-name
channels:
- conda-forge
- defaults
dependencies:
- python=3.7
- codecov
参考链接:Conda 的 yml 文件 Conda/PIP 国内镜像源的添加_conda 安装yaml文件怎么设置镜像-CSDN博客
conda环境转移复制和pip包的转移复制以及替换成清华源channels,pip的阿里源_condaenvexception: pip failed-CSDN博客
这个是有些包安装不上,只能自己一个一个去安装
PackagesNotFoundError: The following packages are not available from current channels的解决办法-CSDN博客
4,问题:CondaEnvException: Pip failed
更换pip的阿里源
pip国内的一些镜像
清华官方:https://mirror.tuna.tsinghua.edu.cn/help/pypi/
豆瓣
https://pypi.doubanio.com/simple/
阿里云
https://mirrors.aliyun.com/pypi/simple/
清华大学
https://pypi.tuna.tsinghua.edu.cn/simple/
https://mirrors.tuna.tsinghua.edu.cn/pypi/web/simple/
临时使用
pip install some-package -i https://mirrors.aliyun.com/pypi/simple/
该网站指定为可信任就行了~
pip install 包名 -i http://pypi.douban.com/simple/ --trusted-host pypi.douban.com
设为默认
升级 pip 到最新的版本后进行配置:
pip install pip -U
pip config set global.index-url https://mirrors.aliyun.com/pypi/simple/
在https://blog.csdn.net/yuzaipiaofei/article/details/80891108中采用了建立pip.ini的方式
永久修改:
linux:
修改 ~/.pip/pip.conf (没有就创建一个), 内容如下:
[global]
index-url = https://pypi.tuna.tsinghua.edu.cn/simple
[install]
trusted-host= pypi.tuna.tsinghua.edu.cn
5,问题:UnsatisfiableError:
UnsatisfiableError: The following specifications were found to be incompatible with each other:
我换成了国外的源就没报错?
anaconda
anaconda-fusion
defaults
conda-forge