如何在 Anaconda 中为不同的 Python 版本安装包? [英] How do I install a package for different Python versions in Anaconda?

查看:27
本文介绍了如何在 Anaconda 中为不同的 Python 版本安装包?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有 Python 2.7 作为 root.我需要在 Python 3.6 中安装包statistics",它不在 anaconda navigator 的环境中.如何使用 condapip 为辅助 Python 环境安装statistics"?

I have Python 2.7 as root. I need to install the package "statistics" in Python 3.6, and it is not in the environments of anaconda navigator. How can install "statistics" with conda or pip for a secondary Python environment?

推荐答案

通过运行创建一个新的 Python 3 环境:

Create a new Python 3 environment by running:

conda create --name python3 python=3

如果您希望默认安装所有标准 anaconda 软件包,请执行以下操作:

If you want all the standard anaconda packages installed by default, do:

conda create --name python3 python=3 anaconda

当你需要使用 python3 时运行:

Whenever you need to use python3 run:

activate python3

然后正常使用命令行.所以,如果你想在你的 python3 环境中安装一些东西,请确保你首先 activate python3.

Then use the command line as normal. So, if you want to install something into your python3 environment, make sure you activate python3 first.

请注意,python 3 拥有自己的统计模块,您可能会发现它很有用,如果您愿意,此模块 已移植到 python 2.

Note that python 3 has it's own statistics module that you may find useful, and this module has been ported to python 2 if you would prefer.

这篇关于如何在 Anaconda 中为不同的 Python 版本安装包?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆