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 |
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.
・ 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.
・ Tensorflow ・ Keras
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 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
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.
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