简体   繁体   中英

How do I install a package for different Python versions in Anaconda?

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?

Create a new Python 3 environment by running:

conda create --name python3 python=3

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

conda create --name python3 python=3 anaconda

Whenever you need to use python3 run:

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM