程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
您现在的位置: 程式師世界 >> 編程語言 >  >> 更多編程語言 >> Python

Set up a jupyter server to let you write Python Online

編輯:Python

List of articles

  • One demand
  • Two install
    • Dependencies
    • 1 Create project folder
    • 2 Set encryption password
    • 3 The configuration file
  • 3、 ... and start-up
  • Four Sign in
  • 5、 ... and Limit


One demand

Bought a cloud server , What would you like to sit on , Discover that you can build an online code environment , Whenever and wherever possible , Open a web page and write code

Need to use jupyter, This is not just a Python Module , It is a service , A concept
My environment is

  • Tencent cloud server ( Public network IP)
  • CentOS7.9
  • Python3.7

Two install

Dependencies

It needs to be installed in advance Python modular

pip install tornado
pip install jupyter

Commands are entered at the terminal

1 Create project folder

My catalog is here , You need to write the configuration file later

mkdir /home/danzhao/jupyter

If you do not create, an error will be reported during configuration

2 Set encryption password

Otherwise, I can't get in . I just set a string of numbers , Then I can't get in
Setting the password needs to be in Python Set up... In the environment

from notebook.auth import passwd
passwd()

You will be prompted to enter your password twice , Just OK 了

Enter password:
Verify password:

After input, a string of encrypted strings will be returned , The cases I returned and those on the official website sha1 Dissimilarity , It's something like this

'argon2:$argon2id$v=19$m=10240,t=10,p=8$asodjfipasjdfpojasdpf$lfU/sauf0asjd0fjas'

Copy it , For later configuration

3 The configuration file

jupyter notebook --generate-config

It returns an address , Tell me that the generated file is in
/root/.jupyter/jupyter_notebook_config.py
The configuration file can be visually modified by software , It's fine too vi modify

vi /root/.jupyter/jupyter_notebook_config.py

Configuration comes later , Because the password needs to be set

The official tip requires ssl To configure , This can https visit . We don't have to do this , Just skip ssl To configure
The necessary settings are as follows

c.NotebookApp.ip = '*' # Look at the instructions yes jupyter The white list IP It means 
c.NotebookApp.password = u'argon2:$argon2id$v=19$m=10240,t=10,p=8$asodjfipasjdfpojasdpf$lfU/sauf0asjd0fjas' # The first 2 Password created in step 
c.NotebookApp.notebook_dir = '/home/danzhao/jupyter' # The first 1 Folder created in step 
c.NotebookApp.open_browser = False
c.NotebookApp.port = 1234 # Here is the port you want to access , It needs to be released from the server 

After configuration, save


3、 ... and start-up

Start at the terminal

jupyter notebook

Some will prompt for --allow-root, Just add in

jupyter notebook --allow-root

Hui He Web Start the service
If it is necessary to continue operation after closing the terminal

nohup jupyter notebook --allow-root

So you can shut down the terminal , Write freely on the web Python 了

Four Sign in

Suppose your public network IP yes 123.123.123.123, Then you can access the port set in the browser

This is my way , Enter password to log in

Log in and look like this . english UI, Not very friendly to China . The next step is to find a way to sinicize it , Although I can understand English

Try to New Here's a new one Python File running

perfect ! Be accomplished

I see another one in the back Clusters, It is also equipped with , Although I don't use it very much


5、 ... and Limit

  • jupyter server For single user only
    Multi user mode requires JupyterHub, At present, it only supports Ubuntu, my CentOS Not yet
  • English version
    This is also a limitation , Not very friendly

  1. 上一篇文章:
  2. 下一篇文章:
Copyright © 程式師世界 All Rights Reserved