简体   繁体   English

我不能为python3安装anaconda

[英]I can't install anaconda for python3

I want to use Jupyter and all the anaconda packages with Python 3.5. 我想使用Jupyter和所有带有Python 3.5的anaconda软件包。

I already have Anaconda and Jupyter working with Python 2.7, but if I open a Python 3.5 session (I type python3 in the terminal) it doesn't show the usual anaconda "credits" and I can't import the modules that I want. 我已经有了Anaconda和Jupyter使用Python 2.7,但是如果我打开一个Python 3.5会话(我在终端中键入python3 )它没有显示通常的anaconda“信用”,我无法导入我想要的模块。

So I tried to download the "Anaconda Python 3.5 graphical installer" from the continuum.io website and when I run the installer it says: 所以我尝试从continuum.io网站下载“Anaconda Python 3.5图形安装程序”,当我运行安装程序时,它说:

Anaconda is already installed in /Users/user/anaconda. Anaconda已安装在/ Users / user / anaconda中。 Use 'conda update anaconda' to update Anaconda. 使用'conda update anaconda'更新Anaconda。

I run it, but it says that all the packages are already installed. 我运行它,但它说已经安装了所有软件包。

What I would like: 我想要的是什么:

I am installing everything from scratch on a new machine (minus the stock Python 2). 我在新机器上从头开始安装所有东西(减去库存Python 2)。 But on my previous computer, i used to run python2 or python3 and have all the packages for both. 但是在我之前的计算机上,我曾经运行过python2python3并且拥有两者的所有包。 I also liked that I could type ipython2 notebook or ipython3 notebook depending on which one i wanted to use. 我也喜欢我可以输入ipython2 notebookipython3 notebook具体取决于我想使用哪一个。 (I know that the command ipython is deprecated, what would be the alternative now?) (我知道命令ipython已被弃用,现在会有什么替代方案?)

I've spent some time looking for a solution, somehow I redownloaded the whole anaconda package and created a separate environment for Python 3 and there it worked (i could import numpy , etc. after launching python3 ). 我花了一些时间寻找解决方案,不知怎的,我重新加载了整个anaconda包并为Python 3创建了一个单独的环境,并且它工作(我可以在启动python3后导入numpy等)。 But now I have a copy (~1Gb) of anaconda, and I have to use source activate python3 and source deactivate to toggle between the two. 但是现在我有一个副本(~1Gb)的anaconda,我必须使用source activate python3source deactivate在两者之间切换。

How can I have the same behaviour as I used to do, without having two copies of anaconda_ 如果没有anaconda_的两个副本,我怎么能像以前那样有相同的行为

You can use your current Anaconda installation and just create an environment based on 3.5. 您可以使用当前的Anaconda安装,只需创建基于3.5的环境。 Anaconda will download and install all compatible packages from the repository so you have a complete installation. Anaconda将从存储库下载并安装所有兼容的软件包,以便您完成安装。

In your terminal window / command shell : 在终端窗口/命令shell中:

conda create -n py35 python=3.5 anaconda

Mac : Mac

To use the new environment (in Mac OS X), you can point your IDE to the required environment folder: 要使用新环境(在Mac OS X中),您可以将IDE指向所需的环境文件夹:

/Users/username/anaconda/envs/py35/python

In the Linux shell, you just need to type: 在Linux shell中,您只需键入:

source activate py35

Windows : Windows

To use the new environment (in Windows), you can point your IDE to the required environment folder: 要使用新环境(在Windows中),可以将IDE指向所需的环境文件夹:

C:\Anaconda\envs\py35\python.exe

On the Windows command line, you just need to type: 在Windows命令行中,您只需键入:

activate py35

Linux: Linux的:

To use the new environment (in Linux), you can point your IDE to the required environment folder: 要使用新环境(在Linux中),可以将IDE指向所需的环境文件夹:

/home/username/anaconda/envs/py35/python

In the Linux shell, you just need to type: 在Linux shell中,您只需键入:

source activate py35

Documentation: http://conda.pydata.org/docs/py2or3.html 文档: http//conda.pydata.org/docs/py2or3.html

You can add as many development environments as you need for Python 2.x/3.x using this method. 您可以使用此方法为Python 2.x / 3.x添加任意数量的开发环境。

The copy of anaconda should be under ~/anaconda . anaconda的副本应该在~/anaconda You might have anaconda and anaconda3 . 你可能有anacondaanaconda3 Remove the one you are not interested in. And in your ~/.profile you will find lines that initialise your environment. 删除你不感兴趣的那个。在~/.profile你会找到初始化环境的行。 For my install, with command line completion, it look like: 对于我的安装,命令行完成,它看起来像:

# Anaconda
export PATH=~/anaconda/bin:"$PATH"
eval "$(register-python-argcomplete conda)"

Make sure you only keep the one you want. 确保你只保留你想要的那个。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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