简体   繁体   中英

I can't install anaconda for python3

I want to use Jupyter and all the anaconda packages with Python 3.5.

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.

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:

Anaconda is already installed in /Users/user/anaconda. Use 'conda update anaconda' to update 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). But on my previous computer, i used to run python2 or python3 and have all the packages for both. I also liked that I could type ipython2 notebook or ipython3 notebook depending on which one i wanted to use. (I know that the command ipython is deprecated, what would be the alternative now?)

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 ). 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.

How can I have the same behaviour as I used to do, without having two copies of anaconda_

You can use your current Anaconda installation and just create an environment based on 3.5. Anaconda will download and install all compatible packages from the repository so you have a complete installation.

In your terminal window / command shell :

conda create -n py35 python=3.5 anaconda

Mac :

To use the new environment (in Mac OS X), you can point your IDE to the required environment folder:

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

In the Linux shell, you just need to type:

source activate py35

Windows :

To use the new environment (in Windows), you can point your IDE to the required environment folder:

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

On the Windows command line, you just need to type:

activate py35

Linux:

To use the new environment (in Linux), you can point your IDE to the required environment folder:

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

In the Linux shell, you just need to type:

source activate py35

Documentation: 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.

The copy of anaconda should be under ~/anaconda . You might have anaconda and anaconda3 . Remove the one you are not interested in. And in your ~/.profile you will find lines that initialise your environment. 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.

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