I talked about Preparing a computer environment for data analysis before, but even if you only have a computer, you can't talk about it without a programming language environment. ..
Today I'll show you how to install Python and its related libraries.
The latest version 3.4.1 was released on 5/18.
Python setup methods include virtual environments for languages such as virtualenv, apt and [brew. Many people use a package management system like [http://brew.sh/).
I recommend building your own programming languages that you often use. The main reasons are as follows.
Also, by standardizing the build and installation destination, it will be easier to understand when uninstalling or switching versions.
The author specifies the directory for most products as follows.
/opt/[Product name]/[version]
It also creates a symbolic link under / opt / [product name] / called current and links it to the version you want to use.
For example:
$ ls -la /opt/python/
drwxr-xr-x 3.3
drwxr-xr-x 3.4
drwxr-xr-x trunk
lrwxrwxrwx current -> 3.4
$ ls -la /opt/ruby/
drwxr-xr-x 1.9.3
drwxr-xr-x 2.0
drwxr-xr-x 2.1
lrwxrwxrwx current -> 2.1
This makes it easy to switch between versions coexisting with older versions, and even uninstalling can be easily removed with rm -rf.
Also, builds use shell scripts rather than manual ones.
For example, to install Python, use this script. https://github.com/ynakayama/tagokura-python/blob/master/installer/install_python.sh
At startup, specify the version in the first argument and the installation destination in the second argument, as described in the comments.
~/install_python.sh 3.4.1 /opt/python/3.4
If you can build by just launching a shell script, you don't have to repeat the manual work when installing on a different host or when building a newer version.
Recently, automation frameworks such as chef have become popular, but shell scripts have long been traditional, so that's right. You don't have to worry about it becoming obsolete easily. It can be used even in the smallest environment that has been around for a long time, and it is easy to check the behavior by looking at the contents when something goes wrong.
It is recommended to install the pip package as well as the main unit with a shell script.
It is a good idea to put all the necessary packages together by referring to this script. https://github.com/ynakayama/tagokura-python/blob/master/installer/install_pip.sh
If you use AWS, you should also include the AWS Command Line Interface.
It is convenient to standardize and automate the installation work of programming languages used in the computer environment. When using in a distributed environment, specify the version and install using the same procedure so that there is no difference between the versions.
Recommended Posts