如何设置Jupiter Notebook服务器并从任何地方访问它(Windows 10)
新程序員指南: (New Programmer’s Guide:)
介紹: (Introduction:)
I want to work from my laptop and have my desktop do all of the heavy lifting.
我想用筆記本電腦工作,讓臺式機完成所有繁重的工作。
It might not seem like it, but that simple request can actually be pretty hard to implement as a new programmer.
看起來似乎不是這樣,但是作為一個新程序員,實際上很難實現(xiàn)簡單的請求。
This article is an attempt to change that and make it easy for everyone.
本文試圖改變這一點并使所有人都容易使用。
It offers a long-term solution to using desktop resources from your laptop:
它提供了從筆記本電腦使用桌面資源的長期解決方案:
- CPU Clock Speed CPU時鐘速度
- CPU Cores CPU核心
- RAM 內(nèi)存
- GPU 顯卡
- HDD/SSD/NVMe 硬盤/ SSD / NVMe
目錄: (Table of Contents:)
Set Up the Remote Desktop on the PC
在PC上設(shè)置遠(yuǎn)程桌面
Set Up the Remote Desktop on the Laptop
在筆記本電腦上設(shè)置遠(yuǎn)程桌面
Set Up Python on the PC
在PC上設(shè)置Python
Set up OpenSSL on the PC
在PC上設(shè)置OpenSSL
Set Up Jupyter on the PC
在PC上設(shè)置Jupyter
Set Up the Text Editor on the PC
在PC上設(shè)置文本編輯器
Edit the PATH Environment Variable on the PC
在PC上編輯PATH環(huán)境變量
Create an SSL Certificate on the PC
在PC上創(chuàng)建SSL證書
Set Up a Configuration File on the PC
在PC上設(shè)置配置文件
Set Up the Server Password on the PC
在PC上設(shè)置服務(wù)器密碼
Set Up the Server on the PC
在PC上設(shè)置服務(wù)器
Access the Server at Home on the Laptop
在筆記本電腦上在家訪問服務(wù)器
Open the Port on the PC
在PC上打開端口
Verify the Port is Working on the PC
驗證端口在PC上是否正常工作
Set Up Port Forwarding on the PC
在PC上設(shè)置端口轉(zhuǎn)發(fā)
Access the Server From Anywhere on the Laptop
從筆記本電腦上的任何地方訪問服務(wù)器
Set Up a Static IP Address on the PC
在PC上設(shè)置靜態(tài)IP地址
在PC上設(shè)置遠(yuǎn)程桌面: (Set Up the Remote Desktop on the PC:)
The remote desktop is only used to set up and troubleshoot the PC.
遠(yuǎn)程桌面僅用于設(shè)置PC并對其進(jìn)行故障排除。
First, we’ll create a TeamViewer account:
首先,我們將創(chuàng)建一個TeamViewer帳戶:
Visit the official website
訪問官方網(wǎng)站
Next, we’ll install the application:
接下來,我們將安裝該應(yīng)用程序:
Visit the download page on the official website
訪問官方網(wǎng)站上的下載頁面
Next, we’ll sign into the application:
接下來,我們將登錄到該應(yīng)用程序:
Next, we’ll authorize the computer:
接下來,我們將授權(quán)計算機:
Lastly, we’ll get the computer :
最后,我們將獲得計算機:
在筆記本電腦上設(shè)置遠(yuǎn)程桌面: (Set Up the Remote Desktop on the Laptop:)
This allows the laptop to set up and troubleshoot the server on the PC.
這使筆記本電腦可以在PC上設(shè)置服務(wù)器并進(jìn)行故障排除。
First, we’ll install the application:
首先,我們將安裝該應(yīng)用程序:
Visit the official website
訪問官方網(wǎng)站
Next, we’ll sign into the application:
接下來,我們將登錄到該應(yīng)用程序:
Next, we’ll authorize the computer:
接下來,我們將授權(quán)計算機:
Lastly, we’ll set up the application:
最后,我們將設(shè)置應(yīng)用程序:
Remember:
記得:
- Both computers must be turned on and awake to establish a connection. 必須打開兩臺計算機,然后將它們喚醒以建立連接。
- The connection will automatically terminate after the window is closed. 關(guān)閉窗口后,連接將自動終止。
在PC上設(shè)置Python: (Set Up Python on the PC:)
This Python version was the latest stable version at the time.
這個Python版本是當(dāng)時的最新穩(wěn)定版本。
First, we’ll download Python:
首先,我們將下載Python:
Visit the download page on the official website
訪問官方網(wǎng)站上的下載頁面
Click the “Executable Installer” that matches your system type
單擊與您的系統(tǒng)類型匹配的“可執(zhí)行安裝程序”
Reference:
參考:
- “Windows x86–64 executable installer” refers to Windows 64-bit “ Windows x86–64可執(zhí)行安裝程序”是指Windows 64位
- “Windows x86 executable installer” refers to Windows 32-bit “ Windows x86可執(zhí)行安裝程序”是指Windows 32位
Next, we’ll install Python:
接下來,我們將安裝Python:
在PC上設(shè)置OpenSSL: (Set up OpenSSL on the PC:)
OpenSSL comes preinstalled with Git on Windows 10.
Windows 10上的Git預(yù)先安裝了OpenSSL。
在PC上設(shè)置Jupyter: (Set Up Jupyter on the PC:)
First, we’ll open Command Prompt:
首先,我們將打開命令提示符:
Next, we’ll install Jupyter:
接下來,我們將安裝Jupyter:
Next, we’ll install the Jupyter extension:
接下來,我們將安裝Jupyter擴(kuò)展:
This extension allows Jupyter Notebook to access the GPU in the desktop.
此擴(kuò)展允許Jupyter Notebook訪問桌面中的GPU。
python -m pip install jupyter_http_over_ws在PC上設(shè)置文本編輯器: (Set Up the Text Editor on the PC:)
This step only applies to computers that don’t have a text editor installed.
此步驟僅適用于未安裝文本編輯器的計算機。
In this section, we’ll install Sublime:
在本節(jié)中,我們將安裝Sublime:
Visit the official website
訪問官方網(wǎng)站
在PC上編輯PATH環(huán)境變量: (Edit the PATH Environment Variable on the PC:)
The PATH environment variable is a list of directories that contain commonly used executable files. The Command Prompt uses that list to run programs that execute commands.
PATH環(huán)境變量是包含常用可執(zhí)行文件的目錄的列表。 命令提示符使用該列表來運行執(zhí)行命令的程序。
First, we’ll open the PATH environment variable:
首先,我們將打開PATH環(huán)境變量:
Next, we’ll add the path that contains the executable Python modules:
接下來,我們將添加包含可執(zhí)行Python模塊的路徑:
Lastly, we’ll save the changes we’ve made to the PATH environment variable:
最后,我們將保存對PATH環(huán)境變量所做的更改:
The “OK” button must be clicked to save the PATH environment variable.
必須單擊“確定”按鈕以保存PATH環(huán)境變量。
在PC上創(chuàng)建SSL證書: (Create an SSL Certificate on the PC:)
SSL stands for Secure Socket Layer. It’s a standard security method that adds a layer of protection to the data being transferred over the server. It works by establishing an encrypted link between the server and the remote browser.
SSL代表安全套接字層。 這是一種標(biāo)準(zhǔn)的安全方法,為通過服務(wù)器傳輸?shù)臄?shù)據(jù)增加了一層保護(hù)。 它通過在服務(wù)器和遠(yuǎn)程瀏覽器之間建立加密鏈接來工作。
First, we’ll open Command Prompt:
首先,我們將打開命令提示符:
Next, we’ll use the cd command to navigate to the Python directory:
接下來,我們將使用cd命令導(dǎo)航到Python目錄:
Next, we’ll create the SSL certificate:
接下來,我們將創(chuàng)建SSL證書:
This command is copied directly from the documentation.
該命令直接從文檔中復(fù)制。
openssl req -config “C:\Program Files\Git\usr\ssl\openssl.cnf” -x509 -nodes -days 365 -newkey rsa:1024 -keyout mykey.key -out mycert.pem在PC上設(shè)置配置文件: (Set Up a Configuration File on the PC:)
First, we’ll create the configuration file for Jupyter Notebook:
首先,我們將為Jupyter Notebook創(chuàng)建配置文件 :
This creates the configuration file in the “.jupyter” directory.
這將在“ .jupyter”目錄中創(chuàng)建配置文件。
jupyter notebook --generate-configNext, we’ll create the an empty JSON file on the Windows PC:
接下來,我們將在Windows PC上創(chuàng)建一個空的JSON文件:
Next, we’ll open Run:
接下來,我們將打開“運行”:
Next, we’ll open the .jupyter directory:
接下來,我們將打開.jupyter目錄:
Next, we’ll open the configuration file:
接下來,我們將打開配置文件:
Next, we’ll get the Windows account name:
接下來,我們將獲得Windows帳戶名:
Lastly, we’ll add the server configurations:
最后,我們將添加服務(wù)器配置:
Reference:
參考:
These configuration options are copied from the documentation
這些配置選項是從文檔中復(fù)制的
- The file paths in the JSON file must use double backslashes JSON文件中的文件路徑必須使用雙反斜杠
在PC上設(shè)置服務(wù)器密碼: (Set Up the Server Password on the PC:)
In this section, we’ll create a password for the Jupyter Notebook server:
在本節(jié)中,我們將為Jupyter Notebook服務(wù)器創(chuàng)建一個密碼:
This adds the hashed password to the JSON configuration file.
這會將哈希密碼添加到JSON配置文件中。
jupyter notebook password在PC上設(shè)置服務(wù)器: (Set Up the Server on the PC:)
First, we’ll open Task Scheduler:
首先,我們將打開任務(wù)計劃程序:
Next, we’ll create a task that starts a program when Windows starts:
接下來,我們將創(chuàng)建一個在Windows啟動時啟動程序的任務(wù):
Next, we’ll specify which program to start:
接下來,我們將指定要啟動的程序:
Lastly, we’ll specify when to start the program:
最后,我們將指定何時啟動程序:
在筆記本電腦上在家訪問服務(wù)器: (Access the Server at Home on the Laptop:)
The server should be accessible from the local network after restarting.
重新啟動后,應(yīng)該可以從本地網(wǎng)絡(luò)訪問服務(wù)器。
First, we’ll restart the Windows PC:
首先,我們將重新啟動Windows PC:
Next, we’ll verify that the server is working:
接下來,我們將驗證服務(wù)器是否正常運行:
Visit the server IP address
訪問服務(wù)器IP地址
Next, we’ll sign into Jupyter Notebook:
接下來,我們將登錄Jupyter Notebook:
Lastly, we’ll bookmark the server IP address:
最后,我們將服務(wù)器IP地址添加為書簽:
The browser will display a warning, but the documentation suggests it’s ok.
瀏覽器將顯示警告,但文檔顯示可以。
Private Jupyter Notebook Server打開PC上的端口: (Open the Port on the PC:)
First, we’ll open the “Advanced Settings” in the Windows firewall:
首先,我們將在Windows防火墻中打開“高級設(shè)置”:
Next, we’ll add a new inbound rule:
接下來,我們將添加一個新的入站規(guī)則:
驗證端口在PC上是否正常工作: (Verify the Port is Working on the PC:)
The port should be accessible from remote networks after it’s opened:
打開端口后,應(yīng)該可以從遠(yuǎn)程網(wǎng)絡(luò)訪問該端口:
In this section, we’ll verify that the port is working:
在本節(jié)中,我們將驗證端口是否正常工作:
Visit a port checking website
訪問端口檢查網(wǎng)站
在PC上設(shè)置端口轉(zhuǎn)發(fā): (Set Up Port Forwarding on the PC:)
This video has a simple explanation of LAN, WAN, and Port Forwarding.
該視頻簡單介紹了LAN,WAN和端口轉(zhuǎn)發(fā)。
First, we’ll get the local IP address of the Windows PC:
首先,我們將獲得Windows PC的本地IP地址:
Next, we’ll sign into the local router:
接下來,我們將登錄到本地路由器:
Visit the router IP address
訪問路由器IP地址
Lastly, we’ll set up the port forwarding:
最后,我們將設(shè)置端口轉(zhuǎn)發(fā):
The specific steps for each router will likely vary, but it should be similar.
每個路由器的具體步驟可能會有所不同,但是應(yīng)該相似。
從筆記本電腦上的任何位置訪問服務(wù)器: (Access the Server from Anywhere on the Laptop:)
First, we’ll get the public IP address on the Windows PC:
首先,我們將在Windows PC上獲得公共IP地址:
Google the public IP address
Google的公共IP地址
Next, we’ll construct the server IP address:
接下來,我們將構(gòu)建服務(wù)器IP地址:
Next, we’ll visit the server IP address on the laptop:
接下來,我們將在筆記本電腦上訪問服務(wù)器IP地址:
Next, we’ll sign into Jupyter Notebook:
接下來,我們將登錄Jupyter Notebook:
Lastly, we’ll bookmark the server IP address:
最后,我們將服務(wù)器IP地址添加為書簽:
Remember:
記得:
- The server isn’t accessible on the local IP address from a remote network 無法通過遠(yuǎn)程網(wǎng)絡(luò)在本地IP地址上訪問服務(wù)器
- The browser can’t connect to the server without the HTTPS protocol 沒有HTTPS協(xié)議,瀏覽器無法連接到服務(wù)器
- The browser can’t connect to the server without the port number 沒有端口號,瀏覽器無法連接到服務(wù)器
- A remote network refers to any network that isn’t the local network 遠(yuǎn)程網(wǎng)絡(luò)是指不是本地網(wǎng)絡(luò)的任何網(wǎng)絡(luò)
在PC上設(shè)置靜態(tài)IP地址: (Set Up a Static IP Address on the PC:)
By default, most internet service providers assign a dynamic IP address to devices. This means the IP address changes regularly. While that’s good for security, it’s bad for remote connections.
默認(rèn)情況下,大多數(shù)Internet服務(wù)提供商將動態(tài)IP地址分配給設(shè)備。 這意味著IP地址會定期更改。 雖然這對安全性有好處,但對遠(yuǎn)程連接卻不利。
This article has a good introduction to “Dynamic” and “Static” IP addresses.
本文對“動態(tài)”和“靜態(tài)” IP地址進(jìn)行了很好的介紹。
First, we’ll set get the network details:
首先,我們將獲取網(wǎng)絡(luò)詳細(xì)信息:
Next, we’ll write down the following details:
接下來,我們將寫下以下詳細(xì)信息:
- IPv4 address IPv4地址
- Subnet Mask 子網(wǎng)掩碼
- Default Gateway 默認(rèn)網(wǎng)關(guān)
- Preferred DNS server (top) 首選DNS服務(wù)器(頂部)
- Alternate DNS server (bottom) 備用DNS服務(wù)器(底部)
Next, we’ll open the network adapter properties:
接下來,我們將打開網(wǎng)絡(luò)適配器屬性:
Next, we’ll open the Internet Protocol Version 4 properties:
接下來,我們將打開“ Internet協(xié)議版本4”屬性:
致謝: (Acknowledgements:)
TaxiCat helped troubleshoot the firewall, router, and port forwarding.
TaxiCat幫助解決了防火墻,路由器和端口轉(zhuǎn)發(fā)問題。
This article helped suggest TeamViewer.
本文有助于建議TeamViewer。
This article helped schedule the server.
本文有助于安排服務(wù)器。
This article helped set up the static IP address.
本文有助于設(shè)置靜態(tài)IP地址。
翻譯自: https://medium.com/swlh/how-to-set-up-a-jupiter-notebook-server-and-access-it-from-a-local-or-remote-network-on-windows-d335c5ba490d
總結(jié)
以上是生活随笔為你收集整理的如何设置Jupiter Notebook服务器并从任何地方访问它(Windows 10)的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: ps怎么把图片拼接起来
- 下一篇: 六、推荐系统原理与应用