** Re-introduction to Python **, so I will write an article for reviewing the basic grammar of Python.
Just a year before I started programming, I was trying to make something out of Python. A year has passed since then, and now I am mainly developing web applications using Ruby.
The reason I came here and decided to review Python again was that I had a job. I am planning to get a job in April next year, and the companies that are planning to get a job are developing services using machine learning and deep learning. I don't get a job as a machine learning engineer, but I think it's easier to understand the service if I've touched it. I have the impression that Python has a wealth of machine learning libraries, so I decided to start by learning Python.
As I mentioned at the beginning, Python was the first language I touched when I started programming, but ** I'm forgetful I completely forgot about grammar etc. **, so I will re-introduce it while leaving this article. I will do it.
--People who have programming experience and want to get started with Python --People who are interested in machine learning and are thinking of studying from Python
I started by reviewing Python's grammar because I wanted to use Python to implement machine learning and deep learning. Note that "code in Python" = "machine learning is possible" is not. If you are interested in machine learning and deep learning, but do not need to implement it if you understand the concept, I think that you should refer to articles and books for that purpose.
The Jupyter Notebook allows you to enter and execute Python code using a web browser. You can execute code that feels like an interactive shell, which is very convenient for moving your hands and learning about Python.
To be able to use Jupyter Notebook, it is quick to install Anaconda Navigator.
** * What is Anaconda Navigator? ** **
Anaconda Navigator is a distribution that contains a lot of software necessary for Python development. Convenient tools such as Jupyter Notebook and spyder are included from the beginning.
Installation procedure for mac (official) Installation procedure for win (official)
If you start Anaconda Navigator installed according to the above procedure, you should see Jupyter Notebook in the menu.
I will post about the basic usage of Jupyter Notebook in another article.
Indispensable for data analysis! How to use Jupyter Notebook [For beginners]
From here, it is for those who do not want to pollute the PC environment. If you don't mind, you can install Jupyter Notebook by the above method.
It is an environment construction of jupyter notebook using docker, but please forgive it because this is a procedure for mac users.
Since the image is published on Docker Hub, use this. jupyter/scipy-notebook jupyter/docker-stacks
This time, I will create ipython_notebook as a working directory and work on it.
By the way, IPython Notebook is the old name for Jupyter Notebook. Originally it was a tool for Python, but now it seems that it has been renamed because it can execute other scripting languages such as Ruby.
Get the image.
ipython_notebook
$docker pull jupyter/scipy-notebook
$docker image ls #jupyter/scipy-Confirm that notebook is displayed
If you execute the last command and jupyter / scipy-notebook is displayed, it's OK.
As we work, we want to mount the host directory, so create a code
directory under / ipython_notebook
.
First, Docker makes sure that / Users is a shared directory with Docker for Mac. (Because the ipython_notebook directory exists under Users this time) Please refer to this article for the confirmation method because it was easy to understand.
ipython_notebook
$mkdir code
$cd code
$pwd #We will use the result of this command later.
Next, create a container from the image taken in 1.
Also, when creating the container, mount the code
directory created in 2 as volume.
Execute the following code to create a container that mounts the directory created in 2.
It should be noted here that the ...
part of / Users / ... / ipython_notebook / code
differs from person to person.
The volume specification is -v host directory path: directory path in the container
, so paste the result of executing the pwd command
earlier into the host directory path here.
ipython_notebook
$docker run -p 8888:8888 --name jupyter -v \
/Users/.../ipython_notebook/code:/home/jovyan/work \
jupyter/scipy-notebook
If you execute the above command, you will get the following execution result, so copy the character string below token =
.
With the option -p 8888: 8888
, accessing http: // localhost: 8888
from any browser will open the authentication page.
Enter the authentication token copied in ↑ here, and enter a new password to log in. (The password you set will be required for the next login.)
The Ctrl C
container will be stopped when you stop the container executed above.
When starting the container from the second time onward, execute docker start jupyter
to start it.
To stop the container, run docker stop jupyter
to stop it.
ipython_notebook
#When stopping the container executed above
Ctrl + C
#When launching the container from the second time onward
$docker container start jupyter
#When stopping the container started by docker container start
$docker container stop jupyter
This completes the Jupyter Notebook environment construction when using Docker.
From the next time, I will write about the basic grammar of Python.
-(Learning environment construction memo) Start Jupyter Notebook in Docker container. -Installation procedure for Anaconda Navigator mac (official) -Installation procedure for Anaconda Navigator win (official) -Indispensable for data analysis! How to use Jupyter Notebook [For beginners]
Recommended Posts