Since the procedure for installing Python on windows has become quite convenient, I will describe the steps from installation to the first step as a memo to explain the series of operations to others.
Python body Useful Python library
Download the installer from the Python official website.
Click ʻInstall Now` to start the installation, and when it is complete, the Python installation is complete.
Type cmd
on the one that appears in [Windows] + [R] and press enter to launch the command prompt.
It's okay if you type python -h
on that screen and get various help.
There are many useful libraries in python.
I will introduce some of them that are convenient to include and how to install them.
Basically, you can install libraries with pip install library name
at the command prompt, but there are some exceptions.
numpy
numpy is a library that is good at handling matrices. It is one of the things that are convenient and often used once you get used to it.
It is possible to install with pip, but the following method is recommended because an error will occur when using the libraries described below.
Go to this site and download the corresponding version. (If the part of cp ○○ is the version and Python 3.6, select the one that is 36)
At the command prompt, enter pip install the downloaded file
to start the installation.
(If you drag and drop the downloaded file to the command prompt, the path will be written automatically.)
scipy
scipy is a library that is good at numerical calculations such as Fourier transform.
If you use pip, an error will occur, so install it using the following method.
Go to this site and download the corresponding version. (If the part of cp ○○ is the version and Python 3.6, select the one that is 36)
At the command prompt, enter pip install the path of the downloaded file
to start the installation.
(If you drag and drop the downloaded file to the command prompt, the path will be written automatically.)
matplotlib
matplotlib is a library that can draw graphs. The range of expression is widened because it is easy to visualize.
matplotlib can be installed by typing pip install matplotlib
at the command prompt.
seaborn
seaborn cleans nicely when drawing with matplotlib.
Since pip does not work, download the seaborn file from this site.
At the command prompt, enter pip install the path of the downloaded file
to start the installation.
(If you drag and drop the downloaded file to the command prompt, the path will be written automatically.)
pandas
pandas is a library that specializes in statistical processing. Processing on data becomes easier.
You can enter pandas by typing pip install pandas
at the command prompt.
Type python
at the command prompt to launch the Python environment.
If there is no error in ʻimport library name`, the installation is complete.
To write Python code, use something like an enhanced version of Notepad called a text editor. What I am using is atom. There are also sublimeText, Vim, Emacs, etc., but I think atom or sublimeText is kind to beginners. Just add some editor and you're ready to go.
Let's take the first step with Python.
Open your favorite editor, write as follows and save it as test.py
test.py
print("hello world!")
Launch the command prompt and move to the folder where test.py
is located.
cd directory path
.Then enter the following at the command prompt to run python.
in[1]
python test.py
If you see the following, you have successfully started to get started with Python.
out[1]
hello world!
Thank you for your hard work (^^)
Recommended Posts