python - 无法使用与“base”相同的 python 版本创建新的 conda 环境
问题描述
我希望为新项目创建新环境,以便可以在其中安装各种包。这些软件包不会影响我的基础环境。我的基础是 3.6.6 我希望我的新环境也应该是相同的 python 版本。但做不到。
这是我所做的:
conda create -n mynewenv # you must specify python version... why?
conda create -n mynewenv python=3.6.6 # so as to make it exact of 'base'. No, you can not specify 3.6.6 but only upto 3.6
conda create -n mynewenv python=3.6 # in the list to install it showed 3.6.8...why? I want only 3.6.6
conda create -n mynewenv python # somewhere I read that just by giving 'python' picks up the 'base' version. But no...it picked 3.7...why?
请提出正确的方法
解决方案
一种方法是仅将 Python 构建信息从base转储到需求文件中,然后将其用于新的 env 创建。这将确保 Python 与base中的 Python 完全相同。
conda list -n base --export | grep "^python=" > base-py.txt
conda create -n mynewenv --file base-py.txt
或者,如果您想要一个避免临时文件的单行:
conda create -n mynewenv --file <(conda list -n base --export | grep "^python=")
推荐阅读
- docker - v0.19.2 超级账本作曲家网络启动失败
- c - 消息队列:执行任务时出现分段错误
- ios - 以下2行有什么区别?
- android - 如果设备正在充电且电池电量已满,如何开始活动?
- sql-server - MSSQL 问题休眠标准
- c++ - 使用 Eigen 标头的模板函数
- firebase - Firebase Firestore 中的哨兵是什么?
- python - Python 将字符串日期转换为 YYYY/MM/DD 日期时间对象
- c# - c# wpf ContentControl和多个UserControls
- mysql - 用于大量 MySQL 连接的 Zabbix 触发器