Anaconda-4.2.0-python3 environment construction (Mac)

What is Python

There are many types of programming languages. Typical examples are C language, Java, html, Python, etc. Among them, C language and Python are compared. Let's look at the differences between them.

C language, Java Python
Advantages Execution speed is fast * Because it is an interpreter * The amount of code that does not need to be compiled is relatively small
Disadvantages Requires compilation, large amount of code, etc.... Execution speed is slow

What is anaconda

A package provided by Continuum Analytics that allows you to install commonly used Python libraries in bulk. There is such a library in anaconda.

pandas numpy jupyter notebook

This time we will install anaconda 4.2.0. The latest version is 4.4.0. Why install an older version? This is because it does not support the library "Keras", which is currently becoming the mainstream in artificial intelligence development. More specifically, the Python version of anaconda 4.2.0 is 3.5 and 4.4.0 is Python 3.6. However, Keras only supports Python 2.7 ~ 3.5. In Python, the library rarely supports the latest version. If you use the latest version, it may be difficult to deal with it because there are fewer reports such as errors compared to the previous version. Therefore, it is important not to install the latest version easily, but to check the correspondence of libraries etc.

Software to be installed this time

Anaconda Python with pre-packaged libraries for engineering, math, data analysis, and more.

Homebrew A package management system that installs software and libraries on your Mac. We will install it to manage pyenv easily.

Pyenv Software that allows you to switch between Python versions. We will install it so that anaconda and existing python can coexist.

Packages to be installed this time

・ Tensorflow ・ Keras

Homebrew installation

Terminal will be used for Python-related software installation. Search for [Terminal] from LaunchPad etc. and start it.

After starting Terminal, enter the following command to install Homebrew.

$ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

You will be prompted to enter the enter key and password along the way. After the installation is complete, use the brew doctor command to check if the installation was successful.

$ brew doctor

Warning will be ignored this time due to time constraints. If you can confirm whether it is normal, let's check the version.

$ brew -v

Did you see the version properly? The version may be old, so let's execute the update command for the time being.

$ brew update

This completes the Homebrew installation.

pyenv installation

pyenv will be installed using Homebrew.

$ brew install pyenv

Next, fill in bash_profile so that you can execute pyenv commands. bash_profile is a file that is read every time you log in. By describing the settings here, pyenv can be executed every time.

$ echo 'export PYENV_ROOT="${HOME}/.pyenv"' >> ~/.bash_profile
$ echo 'export PATH="${PYENV_ROOT}/bin:$PATH"' >> ~/.bash_profile
$ echo 'eval "$(pyenv init -)"' >> ~/.bash_profile

$ exec $SHELL -l

When you're done, restart terminal. If you hit pyenv and terminal and there is a response, the installation is complete.

$ pyenv
pyenv 1.1.3
Usage: pyenv <command> [<args>]

Some useful pyenv commands are:
   commands    List all available pyenv commands
   local       Set or show the local application-specific Python version
   global      Set or show the global Python version
   shell       Set or show the shell-specific Python version
   install     Install a Python version using python-build
   uninstall   Uninstall a specific Python version
   rehash      Rehash pyenv shims (run this after installing executables)
   version     Show the current Python version and its origin
   versions    List all Python versions available to pyenv
   which       Display the full path to an executable
   whence      List all Python versions that contain the given executable

See `pyenv help <command>' for information on a specific command.
For full documentation, see: https://github.com/pyenv/pyenv#readme

Anaconda installation

Execute the following command

$ pyenv install anaconda3-4.2.0

A consent screen will be displayed during installation, so enter yes. A scene to enter the installation destination will appear, so

/Users/"My user name"/.pyenv/versions/anaconda3-4.2.0

Please enter.

Finally, you will be asked if you want to set environment variables, but answer no.

This completes the anaconda installation, but you need to configure it.

$ pyenv global anaconda3-4.2.0

This allows you to use anaconda in any directory. Conversely, if you want only some directories to be anaconda, change global to local. This time, we will proceed with the global setting.

After installing anaconda, restart terminal again and check the version.

$ python -V

If the version notation of anaconda is not shown here, bash_profile may not be described. If the version is displayed properly, the installation of anaconda is completed here.

Package installation

Install the package using a package management system called pip.

$ pip install (package name)

You can install it with.

Also, if you want to specify the version and install

$pip install (package name)==2.1.1

If you want to check the installed packages

$ pip freeze

You can do it with.

If you need other packages when you install the package, it will be installed automatically.

tensorflow tensorflow

$ pip install tensorflow

Keras Keras

$ pip install keras

We would appreciate it if you could donate! Cryptocurrency BTC 18c58m54Lf5AKFqSqhEDU548heoTcUJZk ETH 0x291d860d920c68fb5387d8949a138ee95c8d3f03 ZEC t1KtTRKy9w1Sv5zqi3MYnxZ3zugo54G4gXn REP 0x291d860d920c68fb5387d8949a138ee95c8d3f03

Recommended Posts

Anaconda-4.2.0-python3 environment construction (Mac)
Mac environment construction Python
Pyxel environment construction (Mac)
Python environment construction For Mac
Ansible environment construction For Mac
Mac + Eclipse (PyDev) + Django environment construction
Anaconda environment construction on Mac (2018 version)
I checked Mac Python environment construction
Python environment construction memo on Mac
Environment construction of python3.8 on mac
Python3 TensorFlow for Mac environment construction
DeepIE3D environment construction
Emacs-based environment construction
Linux environment construction
Python environment construction
Environment construction (python)
django environment construction
CodeIgniter environment construction
python environment construction
Python --Environment construction
Python environment construction
Golang environment construction
python environment construction
Word2vec environment construction
Mac OS X Mavericks 10.9.5 Development environment construction
Mac OS X Yosemite 10.10 Development environment construction
Mac OS X development environment construction memo
Python3 TensorFlow environment construction (Mac and pyenv virtualenv)
Environment construction: GCP + Docker
Django project environment construction
python windows environment construction
Python explosive environment construction starting from zero (Mac)
ConoHa environment construction memo
PyData related environment construction
Python development environment construction
YOLO v4 environment construction ①
pyenv + fish environment construction
Mac development environment construction (Ansible + Serverspec + Travis CI)
python2.7 development environment construction
BigGorilla environment construction memo
Mac OS X Mountain Lion 10.8.5 Development environment construction
grip environment construction onCentOS6.5
Anaconda environment construction memo
Golang environment construction [goenv]
Python environment construction @ Win7
Environment construction with anyenv + pyenv (migrate from pyenv only (Mac))
[Ubuntu 18.04] Tensorflow 2.0.0-GPU environment construction
Python + Anaconda + Pycharm environment construction
About Linux environment construction (CentOS)
PyTorch C ++ (LibTorch) environment construction
Pyramid + mongodb environment on Mac
Anaconda environment construction on CentOS7
Django development environment construction memo
First LAMP environment construction (Linux)
Python environment construction (Windows10 + Emacs)
CI environment construction ~ Python edition ~
[Memo] Construction of cygwin environment
ML environment construction with Miniconda
Anaconda3 python environment construction procedure
Docker + Django + React environment construction
Anaconda3 × Pycharm environment construction memo