問題描述
我有 Python 2.7 作為 root.我需要在 Python 3.6 中安裝包statistics",它不在 anaconda navigator 的環境中.如何使用 conda
或 pip
為輔助 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 版本安裝包?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!