Читать книгу Deep Learning for Physical Scientists - Edward O. Pyzer-Knapp - Страница 12

Conda vs. Mini‐conda

Оглавление

When you go to the website, you will see that there are two options for Anaconda; Conda; and Mini‐conda. Mini‐conda is a bare‐bones installation of Python, which does not have any packages attached. This can be useful if you are looking to have a very lean installation (for example, you are building a Docker image, or your computer does not have much space for programmes), but for now we will assume that this is not a problem, and use the full Anaconda installation, which has many packages preinstalled.

You can select the Python2 or Python3 version. If you are running a lot of older code, you might want to use the Python2 version, as Python2 and Python3 codes do not always play well together. If you are working from a clean slate, however, I recommend that you use the Python3 installation as this “future proofs” you somewhat against libraries which make the switch, and no longer support Python2 (the inverse is much rarer, now).

So long as you have chosen Anaconda version (not Mini‐coda), you can just double click the pkg file, and the installation will commence. Once installation is finished (unless you have specific reasons, accept any defaults during installation) you should be able to run.

$ > conda list

If the installation is successful, a list of installed packages will be printed to screen.

But I already have Python installed on my computer? Do I need to uninstall? Anaconda can run alongside any other versions of Python (including any which are installed by the system). In order to make sure that Anaconda is being used, you simply have to make sure that the system knows where it is. This is achieved by editing the PATH environment variable. In order to see whether Anaconda is in your path, run the following command in a Terminal $> echo $PATH To check that Anaconda is set to be the default Python run: $> which python NB the PATH variable should be set by the Anaconda installer, so there is normally no need to do anything.

From here, installing packages is easy. First, search your package on Anaconda's cloud (https://anaconda.org/), and you will be able to choose your package. For example, scikit‐learn's page is at https://anaconda.org/anaconda/scikit‐learn. On each page, the command for installing is given. For scikit‐learn, it looks like this:

$> conda install –c anaconda scikit-learn

Here, the –c flag denotes a specific channel for the conda installer to search to locate the package binaries to install. Usefully, this page also shows all the different operating systems which the package has been built from, so you can be sure that the binary has been built for your system.

Task: Install Anaconda, and use the instructions below to ensure that you have TensorFlow installed on your system

Deep Learning for Physical Scientists

Подняться наверх