How to install Python

background

Let's do machine learning using Python! (`Д´) Elder !! So, it's my first time to touch Python, so it's a memo.

If you have any mistakes, please point them out. Mm

Reference book used this time

-Python Machine Learning Programming Expert Data Scientist Theory and Practice

Our environment

procedure

① Check the Python version of your personal environment

If you are using a Mac, it seems that the 2nd system is included. (The version recommended in the reference book is 3.4.3 or later)

//Check the version in the terminal
$ python --version
Python 2.7.10 

② Introduction of Python3 system

It seems that if you include ANACONDA, it will prepare the necessary packages to some extent. Personal images are like XAMPP, MAMP if you compare it with php. Impression.

If you do not have basic knowledge about ANACONDA, please refer to the following. -Building a python environment for those who aim to become data scientists 2016

Method ① When using ANACONDA

Introduction example Install Python environment with Anaconda
Download destination https://www.continuum.io/downloads
Confirmation method
//Version confirmation
$ python --version

//* Location of the command body
$ which python3
/usr/local/bin/python3

//* Digression.bash_The path has been added to the profile
$ cat ~/.bash_profile
Added command

It seems that the path of the package that is included in the Mac by default is replaced with the one added by ANACONDA. If you are interested, please check it by doing `which``` or `ls -al```.

Description command
Execution command $ python
Package management tool(Upward compatible with pip?) $ conda
Package management tool $ pip
Convert Python2 code to Python3 $ 2to3

Method (2) When not using ANACONDA

Introduction example Python3 installation
Download destination https://www.python.org/downloads/
Confirmation method
//Version confirmation
$ python3 --version

//* Location of the command body
$ which python3
/usr/local/bin/python3

$ ls -al /usr/local/bin/python3
/Library/Frameworks/Python.framework/Versions/3.5/lib/

//* Digression.bash_The path has been added to the profile
$ cat ~/.bash_profile
Added command

It seems that the package will be included with a different name from the package that is included in the Mac by default. If you are interested, please check it by doing `which``` or `ls -al```.

originally
or add
Description command
originally Execution command $ python
originally Package management tool $ pip
add to Execution command $ python3
add to Package management tool $ pip3
add to Convert Python2 code to Python3 $ 2to3

③ Add a package

//Check the package
$ pip list

This time, check if the following packages are included, and if not, try to install them.

Distribution Version
NumPy 1.9.1
SciPy 0.14.0
scikit-learn 0.15.2
matplotlib 1.40.0
pandas 0.15.2

If the above is not included, introduce below

■ When entering with ANACONDA When ANACONDA was installed, a package management tool called `` `conda``` was added, so If you can use it, you should use it to add packages.

//Package introduction
$ conda install <package name>

//Package update
$ conda update <package name>

■ If you have not entered in ANACONDA

//Package introduction
$ pip install <package name>

//Package update
$ pip install <package name> -upgrade

By the way, in my environment, the above package was a little old, so I updated it below.

■ Survey

//With ANACONDA
$ conda list | grep -e numpy -e scipy -e scikit-learn -e matplotlib -e pandas

//No ANACONDA
$ pip list | grep -e numpy -e scipy -e scikit-learn -e matplotlib -e pandas

■ Update

//With ANACONDA
$ conda update matplotlib
$ conda update numpy
$ conda update pandas
$ conda update scikit-learn 
$ conda update scipy

//No ANACONDA
$ pip install matplotlib --upgrade
$ pip install numpy --upgrade
$ pip install pandas --upgrade
$ pip install scikit-learn  --upgrade
$ pip install scipy --upgrade

That's it.

As I wrote at the beginning, if there are any mistakes, It would be helpful if you could point it out mm

Recommended Posts

How to install Python
How to install python
[2020.8 latest] How to install Python
How to install Python [Windows]
How to install python using anaconda
How to install pip
How to install archlinux
How to install BayesOpt
How to install Nbextensions
How to install Prover9
How to install and use pandas_datareader [Python]
python3 How to install an external module
[Kivy] How to install Kivy on Windows [Python]
How to install python3 with docker centos
[2020 version] How to install Python3 on AWS EC2
python3: How to use bottle (2)
How to install OpenCV on Jetson Nano Python
install python
Tabpy 1.0 (2020-01 version) How to install
[Python] How to use list 1
How to update Python Tkinter to 8.6
How to install Python for pharmaceutical company researchers
How to use Python argparse
How to install mkl numpy
Python: How to use pydub
[Python] How to use checkio
How to run Notepad ++ Python
How to change Python version
How to install Pelican blog
[Python] How to install OpenCV on Anaconda [Windows]
How to develop in Python
[python] How to judge scalar
[Python] How to use input ()
How to use Python lambda
[Python] How to use virtualenv
python3: How to use bottle (3)
python3: How to use bottle
How to use Python bytes
How to write a Python class
[Python] How to FFT mp3 data
[Python] How to do PCA in Python
Python: How to use async with
How to install mysql-connector-python on mac
How to install and use Tesseract-OCR
[Python] How to derive nCk (ABC156-D)
[Python] How to use Pandas Series
How to collect images in Python
How to use Requests (Python Library)
How to use SQLite in Python
[Introduction to Python] How to parse JSON
How to install python-pip with ubuntu20.04LTS
How to install graph-tool on macOS
How to install wkhtmltopdf (Amazon Linux2)
How to install VMware-Tools on Linux
How to install pycrypto on Windows
How to get the Python version
How to install OpenCV on Mac
How to install MBDyn (Linux Ubuntu)
How to install PyPy on CentOS
How to get started with Python
[Python] How to import the library