1. Compile and install Python 3.9.7

As a learner, I like to install the latest version of Python. If you don’t want a new version, you can install it at the command line with yum install python3 -y.

1.1 Preparing installation Packages

# into the directory/usr/local/CD/usr/local # download Python - 3.9.7. TGZ wget https://www.python.org/ftp/python/3.9.7/Python-3.9.7.tgz # Decompress the decompression package. The default path is python-3.9.7 / tar -zxvf python-3.9.7.tgzCopy the code

1.2 Environment Dependent Installation

ModuleNotFoundError: No module named '_ctypes' yum install libffi-devel-yCopy the code

The above explanation comes from:The original linkAuthor’s statement: in order to prevent the external link from suddenly failing to access, so use the content screenshot form, if there is infringement, please contact the author to delete, thank you for your cooperation.

1.3 Compilation and Installation

CD python-3.9.7 / mkdir.. --enable-optimizations./configure --prefix=/usr/local/python39Copy the code

Do not add –enable-optimizations after./configure. With –enable-optimizations, you will get the Could not import runpy Module installation error on earlier versions of GCC

Solution (method 1 not try) : 1, upgrade the GCC to high version, GCC 8.1.0 has 2, fix the problem. / configure parameters removed – enable optimizations

Make make install make cleanCopy the code

1.4 Adding Environment Variables

ln -s /usr/local/python39/bin/python3 /usr/bin/python3
ln -s /usr/local/python39/bin/pip3 /usr/bin/pip3
Copy the code

1.5 Verifying the Installation

Python3 --version # Output: Python 3.9.7Copy the code

2. Installation of the Jupyter Notebook

The Jupyter Notebook is an open-source web application that allows you to create and share documents that contain live code, equations, visualizations and narrative text. Uses include: data cleaning and transformation, numerical simulation, statistical modeling, data visualization, machine learning, and much more. Project Jupyter | Home

2.1 Installing the Jupyter Notebook In PIP Mode

Pip3 install jupyter notebook pip3 install jupyterCopy the code

2.2 Adding environment Variables

Pip3 show jupyterCopy the code

vim .bashrc
Copy the code

Yum install vim -y yum install vim -y yum install vim -y

Vim /vi simple use: English input method: I enter INSERT mode, allow input content; When ESC exits editing mode, enter:

/ Search keyword Press Enter to search for the specified content. :wq Save the configuration and exit. : q exit; :q! Exit without saving

Source /etc/profileCopy the code

2.3 Configuration Change

Jupyter notebook password cat ~/. Jupyter /jupyter_notebook_config.jsonCopy the code

# jupyter notebook -- generated-config vim ~/. Jupyter /jupyter_notebook_config.pyCopy the code

C. notebookapp. allow_remote_access = True: Whether remote access is allowed. The default value is False

C. notebookapp. allow_root = True: Indicates whether jupyter is allowed to run as root. The default value is False

C. notebookapp. IP = ‘0.0.0.0’ : allow access from all IP addresses

C.notebooks notebook_dir = ‘/root/jupyter_notebooks

C. notebookapp. open_browser = False: Whether to open the browser when typing jupyter

C. notebookapp. password = ‘argon2:$argon2ID $’ : Jupyter Server password.

C. notebookapp. port = 8888: Listening port of Jupyter. The default port is 8888

2.4 Background Startup

nohup jupyter notebook &
Copy the code

The above explanation comes from:The original linkAuthor’s statement: in order to prevent the external link from suddenly failing to access, so use the content screenshot form, if there is infringement, please contact the author to delete, thank you for your cooperation.

2.5 Other Precautions for Remote Access

1. The firewall port is open

systemctl status firewalld
firewall-cmd --list-port
firewall-cmd --zone=public --add-port=8888/tcp --permanent
firewall-cmd --reload 或者 systemctl reload firewalld
Copy the code

2. Add a cloud server security group

If a cloud server is used, add a permit rule for port 8888 on the console page of the cloud server provider. Enable the port based on the actual situation