Dockerä»å¹´åºè¯¥ç®æ¯å¾çé¨çææ¯äºï¼ä¹åä¸ç´æ²¡æä¹çæ£å°å»äºè§£ãæ¥è§¦ãéè¿ç¿»è¯è¿ç¯ç®åçæç¨ï¼æåæ¶ä¹å¯¹Dcokeræäºå
¥é¨çäºè§£ãDockeråæç®å使ç¨çVagrantæäºç±»ä¼¼ä¹å¤ï¼é½æ¯éè¿ç±»ä¼¼éåçæ件å建å¤ç«çç³»ç»ç¯å¢ãåªæ¯Docker容å¨ä¸å·²ç»å®è£
äºæéçå
ï¼èæç®åæäºè§£çVagrant
boxè¿æ²¡æè¿ä¸ªåè½ãå½ç¶ï¼åºè¯¥æ¯æ使ç¨ç¨åº¦ä¸æ·±çåå ãä¸ç®¡æä¹è¯´ï¼Dockerç¡®å®æ¯è·¨å¹³å°å¼åçå©å¨ãè¯æå¦ææä»ä¹ä¸åç¡®çå°æ¹ï¼è¯·å¤§å®¶ææ£ã
æ°æ®ç§å¦å¼åç¯å¢é
置起æ¥è®©äººå¤´ç¼ï¼ä¼ç¢°å°å
çæ¬ä¸ä¸è´ãé误信æ¯ä¸çæåç¼è¯æ¶é´æ¼«é¿çé®é¢ãè¿å¾å®¹æ让人å头丧æ°ï¼ä¹ä½¿å¾è¿å
¥æ°æ®ç§å¦çè¿ç¬¬ä¸æ¥ååè°é¾ãèä¸è¿ä¹æ¯ä¸ä¸ªå®å
¨ä¸å¸¸è§çåå
¥é¨æ§ã
è¿å¥½ï¼è¿å»å å¹´ä¸åºç°äºè½å¤éè¿æ建å¤ç«çç¯å¢æ¥è§£å³è¿ä¸ªé®é¢çææ¯ãæ¬æä¸æ们就è¦ä»ç»çè¿ç§ææ¯åå«DockerãDockerè½è®©å¼åè
ç®åãå¿«éå°æ建æ°æ®ç§å¦å¼åç¯å¢ï¼å¹¶æ¯æ使ç¨ä¾å¦Jupyter notebooksçå·¥å
·è¿è¡æ°æ®æ¢ç´¢ã
è¦ä½¿ç¨Dockerï¼æ们è¦å
ä¸è½½å«æç¸å
³å
ï¼packageï¼åæ°æ®ç§å¦å·¥å
·çéåæ件ãä¹åï¼æ们å¯ä»¥éè¿è¯¥éåï¼å¨æ°ç§ä¹å
å°±å¯å¨ä¸ä¸ªæ°æ®ç§å¦å¼åç¯å¢ï¼å
å»äºæå¨å®è£
å
ç麻ç¦ãè¿ä¸ªç¯å¢ï¼ä¹è¢«æ为Docker容å¨ï¼containerï¼ã容å¨è§£é¤äºé
ç½®çé®é¢ââå½ä½ å¯å¨ä¸ä¸ªDocker容å¨åï¼å®å°±å·²ç»å¤äºäºè¯å¥½çç¶æï¼ææçå
é½æ¯å¯ä»¥æ£å¸¸è¿è½¬çã
é¤äºéä½è¿å
¥æ°æ®ç§å¦çé¨æ§ä¹å¤ï¼Dockerè¿å¯ä»¥è®©æ们快éæ建æ¥æä¸åPythonçæ¬åå®è£
äºä¸åå
çå¤ç«ç¯å¢ï¼ä¸åèæç¯å¢ï¼virtualenvï¼é£æ ·è¿è¦éæ°å®è£
å
ã
å¨æ¬æä¸ï¼æ们å°ä»ç»Dockerçåºç¡ç¥è¯ï¼å¦ä½å®è£
Docker以åå¦ä½å©ç¨Docker容å¨å¿«éå°å¨æ¬å°æºå¨ä¸æ建æ°æ®ç§å¦ç¯å¢ã
èææº
è½å¤å建èææºç软件已ç»é®ä¸æ°åå¹´ï¼å¯ä»¥è®©ä½ å¨æ¬å°çµèä¸æ¨¡æå
¶ä»çç³»ç»ç¯å¢ã举个ä¾åï¼å³ä½¿ä½ ççµèè¿è¡çæ¯Windowsæä½ç³»ç»ï¼ä½ ä»å¯ä»¥éè¿èææºè¿è¡Linuxç³»ç»ãè¿å¯ä»¥è®©ä½ å¨ä¸éè£
ç³»ç»çåæä¸ï¼ä½¿ç¨Linuxââä¹å°±æ¯è¯´ï¼Linuxç³»ç»æ¯èæåè¿è¡çï¼æä»¥ä½ å¯ä»¥ä»Windowsç³»ç»è®¿é®èææºãåºæ¬ä¸ï¼ä½ å¯ä»¥å¨ç¹å»è¯¥è½¯ä»¶çç¨åºå¾æ ä¹åï¼çå°å¼¹åºççªå£ä¸ä¹æ¯ä¸ä¸ªLinuxç³»ç»æ¡é¢ãèèææºéè¦éåæ¥å¯å¨ï¼ä¹å°±æ¯ä½ å¿
é¡»å
æ¥æä¸ä¸ªç®æ ç³»ç»çéåï¼æè½å¯å¨ç¸åºçèææºãå¦æä½ æ³ä½¿ç¨Linuxï¼ä½ 使ç¨çéåå°±å¾å
å«å建Linuxç¯å¢æå¿
é¡»çå
¨é¨æ件ã
容å¨
尽管èææºæ诸å¤å¥½å¤ï¼ä¾å¦è½å¤ä½¿å¨Windowså¹³å°è¿è¡Linuxå¼åæ为ç°å®ï¼ä½æ¯ä¹æçèªèº«ç缺é·ãé¦å
ï¼èææºçå¯å¨æ¶é´å¾é¿ï¼è¦æ¶è大éçç³»ç»èµæºãå¦å¤ï¼å¨å©ç¨éåå建å®èææºä¸ï¼å¾é¾å¨å®è£
å®æéè¦çå
åï¼åå°è¿ä¸ªéåä¿åï¼å建为æ°çéåãèDockeræä¾çLinux容å¨ï¼åéè¿è®©å¤ä¸ªå¤ç«ç¯å¢å¨åä¸å°æºå¨ä¸è¿è¡ï¼è§£å³äºè¿ä¸ªé®é¢ãä½ å¯ä»¥æ容å¨çä½æ¯ä¸ç§æ´å¿«ãæ´ç®åå°ä½¿ç¨èææºçæ¹æ³ã
ä½æ¯ï¼å®¹å¨ç使ç¨å´æä¸ç¹éº»ç¦ï¼èä¸ç®¡çååå¸å®¹å¨éåä¹ä¸å®¹æãä½ä¸ºå¼å人åï¼æ们å¸æè½å¤å¿«éä¸è½½å¹¶å¯å¨ä¸ä¸ªæ¥ææå®å
åå·¥å
·é
ç½®çæ°æ®ç§å¦ç¯å¢ãä¾å¦ï¼ä½ è¯å®ä¼å¸æè½å¿«éå¯å¨ä¸ä¸ªå®è£
äºJupyter notebookãsparkåpandasç容å¨ã
Docker
Docker容å¨çéå±å
裹çæ¯Linux容å¨ï¼a layer over Linux
containersï¼ï¼å¯ä»¥æ¯ææ´ç®åå°å¯¹å®¹å¨è¿è¡ç®¡çååå¸ã使ç¨Dockerï¼å¯ä»¥å¾å®¹æå°ä¸è½½å
·å¤ç¸åºå
çéåï¼å¹¶ä¸å¿«éå¯å¨ãå¦å¤ï¼Dockeræ¯è·¨å¹³å°çï¼æ¯æå
æ¬MacãWindowsåLinuxçç³»ç»ã
ä½ä¸ºå建å¤ç«Pythonç¯å¢çå¦ä¸ç§æ¹å¼ï¼èæç¯å¢ï¼virtual environmentï¼ä¹æè¿äºä¼å¿ãä½æ¯Dockerç¸è¾äºèæç¯å¢ç主è¦ä¼å¿æï¼
è½å¤å¿«éå¯å¨ãå¦æä½ æ³é©¬ä¸å°±å¼å§è¿è¡æ°æ®åæï¼ä½¿ç¨Dockerå°±å
å»äºä½ çå¾
åç§å
è¿è¡å®è£
çæ¶é´ã
é
ç½®æµè¯æ 误ãå¾å¤æ¶åï¼è¦æ£å¸¸å®è£
Pythonå
ä¼ï¼éè¦ä»¥å®è£
æäºç³»ç»å
为åæï¼å¹¶åªæå¨è¿è¡ç¸åºè®¾ç½®åæè½æ£å¸¸ä½¿ç¨ãå¦æ设置ä¸å½ï¼ä¼å¼èµ·ä¸äºå¾å¥æªçé误ãä½æ¯ä½¿ç¨Dockeråï¼è¿äºå
就已ç»é
置好äºï¼å¯ä»¥ç«å³ä½¿ç¨ã
跨平å°ä¸è´æ§ãPythonä¸çå
æ¯å¯ä»¥è·¨å¹³å°ä½¿ç¨çï¼ä½æ¯å¨WindowsåLinuxå¹³å°ä¸æäºä¸åï¼èä¸è¿æé¨åä¾èµå
æ æ³å¨Windowsä¸å®è£
ãä½æ¯ç±äºDocker容å¨è¿è¡çé½æ¯Linuxç¯å¢ï¼æ以å®ä»¬æ¯é«åº¦ä¸è´çã
è½å¤è®¾ç½®checkpoint并ä¸è¿è¡æ¢å¤ãä½ å¯ä»¥å¾Dockeréåä¸å®è£
å
ï¼ç¶åå°é£ä¸ªcheckpointä¸çç¯å¢å建æä¸ä¸ªæ°çéåãè¿è®©ä½ è½å¤å¿«éæ¤éæè
åæ»é
ç½®ã
è¿è¡ä¸ä¸ªDockeréåï¼å°±ç¸å½äºå建äºä¸ä¸ªDocker容å¨ãå¨æ¬æä¸ï¼æ们å¨å®¹å¨ä¸è¿è¡ä¸ä¸ªJupyter notebookï¼ç¶åéè¿æµè§å¨çé¢æ¥å¤çæ°æ®ã
å®è£
Docker
第ä¸æ¥å°±æ¯å®è£
DockerãDockerå®æ¹ä¸ºWindowsåMacç¨æ·æä¾äºä¸ä¸ªç®ä¾¿å®è£
è¿ç¨çå¾å½¢çé¢å®è£
å¨ãä¸é¢æ¯æ¯ä¸ªæä½ç³»ç»çå®è£
æåã
Mac OS
Linux
Windows
å¨å®è£
æ¶ï¼ä½ éè¦ä½¿ç¨shellå½ä»¤æ示符ï¼shell promptï¼ãshellå½ä»¤æ示符ï¼shell
promptï¼ä¹è¢«ç§°ä¸ºç»ç«¯æå½ä»¤è¡ï¼æ¯å¨ä½ çæºå¨ä¸éè¿ææ¬çé¢èéå¾å½¢çé¢è¿è¡å½ä»¤çä¸ç§æ¹å¼ãä¾å¦ï¼ä½ å¯ä»¥å¨Windowsç³»ç»ä¸åå»è®°äºæ¬å°±å¯ä»¥æå¼ä¸ä¸ªææ¬ç¼è¾å¨ï¼ä¹å¯ä»¥å¨Linuxç»ç«¯ä¸è¾å
¥nanoè¾¾å°è¿ä¸ªç®çãDockeræä¾äºä¸ä¸ªé¢å
é
置好çshellï¼å¯ä»¥ç¨æ¥è¿è¡Dockerå½ä»¤ã请æç
§ä¸é¢çæ¹æ³æä½ï¼
Mac OS ââ ä»Launchpadä¸æå¼Docker Quickstart Terminalç¨åºã详æ
è§æ¬ç¯æç« ã
Linux ââ æå¼ä»»æbashç»ç«¯ï¼å°±å¯ä»¥ä½¿ç¨dockerå½ä»¤ã
Windows ââ åå»æ¡é¢ä¸çDocker QuickstartTerminalç¨åºçå¾æ ã详æ
è§æ¬ç¯æç« ã
ä¸æå¨æå°éè¦è¿è¡Dockerå½ä»¤æè¾å
¥æ个å½ä»¤æ¶ï¼ä½ é½éè¦ä½¿ç¨è¿ä¸ªshellå½ä»¤æ示符ã
ä¸è½½éå
ä¸ä¸æ¥æ¯ä¸è½½ä½ éè¦çéåãä¸é¢æ¯æ们ç½ç«(dataquestio)ç®åæä¾çæ°æ®ç§å¦å¼åä¸ç¨éåï¼
dataquestio/python3-starter ââ è¿ä¸ªéåå·²ç»å®è£
好äºPython 3, Jupyter notebookå许å¤å
¶ä»æµè¡çæ°æ®ç§å¦åºï¼å
æ¬numpyï¼pandasï¼scipyï¼scikit-learnånltkã
dataquestio/python2-starter ââ è¿ä¸ªéåå·²ç»å®è£
好äºPython 2, Jupyter notebookå许å¤å
¶ä»æµè¡çæ°æ®ç§å¦åºï¼å
æ¬numpyï¼pandasï¼scipyï¼scikit-learnånltkã
ä½ å¯ä»¥éè¿è¾å
¥docker pull IMAGE_NAMEå½ä»¤ï¼ä¸è½½ç¸åºçéåãå¦æä½ æ³ä¸è½½dataquestio/python3-starterè¿ä¸ªéåï¼é£ä¹ä½ éè¦å¨ç»ç«¯è¾å
¥docker pull dataquestio/python3-starterå½ä»¤ãè¾å
¥è¿æ®µå½ä»¤åï¼ç¨åºä¼èªå¨ä»Docker Hubä¸è½½éåãDocker Hubä¸Github类似ï¼ä¸è¿å´æ¯Dockeréåçä¸ä¸ªä¸æ¢ãå®ä¼å°ç¸åºçéåæ件ä¸è½½è³ä½ çæ¬å°æºå¨ï¼è¿æ ·ä½ æè½å©ç¨è¯¥éåå建容å¨ã
æ°å»ºä¸ä¸ªæ件夹
å¨æ¬å°å建ä¸ä¸ªæ件夹ï¼ç¨äºåæ¾notebooksãè¿ä¸ªæ件夹ä¸å°å¨åä½ ææçå·¥ä½æ件ï¼å¹¶ä¼æç»åå¨äºä½ çæºå¨ä¸ï¼å³ä½¿æ¯ä½ éæ¯äºdocker容å¨ãå¨è¿éï¼æ们å°å建ä¸é¢è¿ä¸ªæ件夹ï¼/home/vik/notebooksã
è¿è¡éå
éåä¸è½½å®æåï¼ä½ å¯ä»¥éè¿docker runè¿è¡è¯¥éåãæ们è¿éè¦ä¼ å
¥ä¸äºé项ï¼ç¡®ä¿éåé
ç½®æ£ç¡®ã
-p é项ç¨äºè®¾ç½®èææºç端å£ï¼è®©æ们å¯ä»¥å¨æ¬å°è®¿é®Jupyter notebookæå¡å¨ã
-d é项ç¨äºä»¥detached模å¼è¿è¡å®¹å¨ï¼ä¹å°±æ¯ä½ä¸ºèæ¯è¿ç¨è¿è¡ã
-v é项让æ们æå®å¨æ¬å°æºå¨ä¸ä½¿ç¨åªä¸ªæ件夹åå¨notebookã
å®æ´çè¿è¡å½ä»¤æ¯ç±»ä¼¼è¿æ ·çï¼docker run -d -p 8888:8888 -v /home/vik/notebooks:/home/ds/notebooks dataquestio/python3-starterã
ä½ åºè¯¥å°/home/vik/notebooksæ´æ¹ä¸ºä½ ç¨äºåå¨æ件çå°åãå¦å¤ï¼åºè¯¥ædataquestio/python3-starteræ´æ¹ä¸ºèªå·±å欢çdockeréåã
æ§è¡docker runå½ä»¤å°ä¼å建ä¸ä¸ªDocker容å¨ãè¿æ¯ä¸ä½ çæ¬å°æºå¨ç¸éç»çï¼ä¹å¯ä»¥æå®çä½æ¯ä¸å°åç¬ççµèãå¨å®¹å¨å
é¨ï¼ä¼è¿è¡ä¸ä¸ªJupyter notebookæå¡å¨ï¼å¹¶å¯ä»¥è®©æ们使ç¨è®¸å¤æ°æ®ç§å¦å·¥å
·å
ã
å¦å¤ï¼docker runå½ä»¤ä¹ä¼å¨ç»ç«¯æå°åºå®¹å¨çç¼ç ï¼container id ï¼ï¼å¨éè¿å
¶ä»docker容å¨å¯¹è¯¥å®¹å¨è¿è¡ä¿®æ¹æ¶ï¼å°±å¿
é¡»è¦ä½¿ç¨è¿ä¸ªç¼ç ãå¨ä¸æä¸æ们称该ç¼ç 为容å¨ç¼ç ã
æ¥çnotebookæå¡å¨
å¦æä½ çç³»ç»æ¯Linuxï¼é£ä¹ä¸ä¸æ¥é常ç®åââåªéè¦å¨æµè§å¨ä¸æå¼localhost:8888ï¼ä¹ååºè¯¥å°±è½çå°è¿è¡ä¸çnotebookãå¦æä½ ä½¿ç¨çæ¯WindowsæOSXï¼ä¹åä¹æç
§Dockerå®æ¹å®è£
æåè¿è¡äºæä½ï¼å¹¶ä¸å®è£
è¿ç¨ä¸ä½¿ç¨äºdocker-machineï¼é£ä¹æ¬å°æºå¨çå称æ¯defaultï¼è¿è¡docker-machine ip defaultå½ä»¤å°±å¯ä»¥å¾ç¥docker容å¨çipãå¦æ使ç¨äºå
¶ä»çååï¼ä¾å¦devï¼é£å¨å½ä»¤ä¸å°defaultæ¿æ¢ä¸ºdevå³å¯ãæ¥ä¸æ¥ï¼å¨æµè§å¨ä¸è®¿é®CONTAINER_IP:8888å°±å¯ä»¥çå°notebookï¼å°CONTAINER_IPæ¿æ¢ä¸ºä½ ç容å¨ç¼ç ï¼ã
å建ä¸ä¸ªnotebook
å°äºè¿ä¸æ¥ï¼ä½ å¯ä»¥å建ä¸ä¸ªæ°çJupyter notebookæµè¯ä¸è¿ä¸ªå¤ç«çå¼åç¯å¢ãè¯è¯è¾å
¥ä¸é¢è¿ä¸ªscikit-learnçä¾åï¼
from sklearn import datasets
from sklearn.cross_validation import cross_val_predict
from sklearn import linear_model
import matplotlib.pyplot as plt
%matplotlib inline
lr = linear_model.LinearRegression()
boston = datasets.load_boston()
y = boston.target
predicted = cross_val_predict(lr, boston.data, y, cv=10)
fig, ax = plt.subplots()
ax.scatter(y, predicted)
ax.plot([y.min(), y.max()], [y.min(), y.max()], 'k--', lw=4)
ax.set_xlabel('Measured')
ax.set_ylabel('Predicted')
plt.show()
æ·»å æ°æ®æ件
å¦æä½ æ³å¾å¼åç¯å¢ä¸æ·»å æ°æ®æ件ï¼ä½ æä¸ä¸ªéæ©ã第ä¸ä¸ªéæ©ï¼å°±æ¯å°æ件æ¾å¨ä½ ä¹åå建ç¨æ¥åæ¾notebookçæ件夹ä¸ãä½ æ¾é£éçä»»ä½æ件å°å¯ä»¥èªå¨éè¿Jupyter notebookä¸è®¿é®ã
第äºç§éæ©å°±æ¯ä½¿ç¨docker cpå½ä»¤ãdocker cpå¯ä»¥ä»æ¬å°æºå¨å¤å¶æ件è³å®¹å¨ä¸ï¼åä¹äº¦ç¶ãåè®¾ä½ æ³æ·è´/hom/vik/data.csvæ件è³ä¸ä¸ªid为4greg24134ç容å¨ä¸ï¼ä½ å¯ä»¥è¾å
¥ä¸é¢çå½ä»¤ï¼docker cp /home/vik/data.csv 4greg24134:/home/ds/notebooksãè¿ä¼å°data.csvæ件æ·è´å°å®¹å¨ä¸ç¨äºåæ¾notebookçæ件夹ä¸ãå½ç¶ï¼ä½ å¯ä»¥éæ©å°æ件æ¾å°å®¹å¨ä¸çä»»ä½å°æ¹ï¼ä½æ¯æå®ä»¬æ¾å¨åæ¾notebookçæä»¶å¤¹å¿ åï¼ä½ å°±å¯ä»¥è½»æ¾å°éè¿Jupyter notebook访é®è¿äºæ件äºã
第ä¸ä¸ªéæ©å°±æ¯ä½¿ç¨Jupyter notebooké¦é¡µå³ä¸æ¹çuploadæé®ãè¿å¯ä»¥è®©ä½ éæ©ä¸ä¸ªæ件ï¼å¹¶ä¸ä¼ å°å®¹å¨ä¸ç¨äºåæ¾notebookçæ件夹ä¸ã
ä¸ç®¡ä½ 使ç¨åªç§æ¹æ³ï¼è¦æ³å¨Jupyter notebookä¸å è½½æ件ï¼éè¦æç
§ç±»ä¼¼ä¸é¢çæ¹å¼è¿è¡ï¼
import pandas
data = pandas.read_csv("data.csv")
å¤å¶å®¹å¨ä¸çæ°æ®æ件
ä½ å¯è½ä¼éè¦ä»å®¹å¨ä¸æ·è´æ件è³æ¬å°æºå¨ãæ容æçåæ³å°±æ¯ææ件æ¾ç½®å¨/home/ds/notebooksæ件夹ä¸ï¼è¿æ ·çè¯è¿äºæ件就ä¼èªå¨æ åå°æ¬å°æºå¨ã
å¦ä¸ç§æ¹æ³ä¹å°±æ¯å©ç¨docker cpå½ä»¤ãåè®¾ä½ æ³ä»id为4greg24314ç容å¨ä¸ï¼æ/home/ds/notebooks/data.csvæ件æ·è´è³æ¬å°æºå¨ç/home/vik/æ件夹ä¸ï¼ä½ å¯ä»¥è¾å
¥ä¸é¢çå½ä»¤ï¼cp 4greg24134:/home/ds/notebooks/data.csv /home/vik/data.csvã
æåä¸ç§æ¹æ³å°±æ¯ä½¿ç¨Jupyterçé¢ä¸çdownloadé项ãå¨ç½é¡µæ¨¡å¼ä¸ç¹å»ä¸ä¸ªä¸æ¯notebookçæ件ï¼å°ä¼å°å
¶ä¸è½½è³æ¬å°ãå¦æä½ å·²ç»æå¼äºä¸ä¸ªnotebookï¼é£ä¹å¯ä»¥å
ç¹å»Fileï¼ç¶åéä¸download aså°±å¯ä»¥ä¸è½½è³æ¬å°ã
å®è£
æ´å¤çå·¥å
·å
å¦æä½ æ³å¨å®¹å¨ä¸å®è£
æ´å¤çå·¥å
·å
ï¼ä½ å¯ä»¥éè¿æ£å¸¸çbashå½ä»¤è¡å½ä»¤å°±å¯ä»¥å®ç°ãè¦æ³å¨å®¹å¨ä¸æ§è¡è¿äºå½ä»¤ï¼ä½ éè¦è¿è¡docker execå½ä»¤ãè¿ä¸ªå½ä»¤æ¥å容å¨çidä½ä¸ºåæ°ï¼ä»¥åä¸ä¸ªææè¿è¡çå½ä»¤ãä¾å¦è¾å
¥docker exec -it 4greg24134 /bin/bashå°ä¼å¨ç¼ç 为4greg24134ç容å¨ä¸å¼å¯ä¸ä¸ªshellå½ä»¤æ示符ï¼shell promptï¼ã-ité项确ä¿æ们å¨å®¹å¨ä¸æå¼äºä¸ä¸ªè¾å
¥ä¼è¯ï¼å¹¶ä¸å¯ä»¥è¾å
¥å½ä»¤ã
å¨è¿è¡docker execå½ä»¤ä¹åï¼ä½ å°±ä¼çå°å®¹å¨ä¸çshellå½ä»¤æ示符ï¼shell promptï¼åºç°ã容å¨æ¤æ¶æ£éè¿ä¸ä¸ªå为dsçèæç¯å¢è¿è¡Pythonç¨åºï¼è¿ä¸ªèæç¯å¢å·²ç»æ¯å¤äºæ¿æ´»ç¶æçã
æ¥ä¸æ¥ï¼åªéè¦è¾å
¥pip install PACKAGE_NAMEå°±å¯ä»¥å®è£
å
¶ä»çå·¥å
·å
ãä¾å¦ï¼ä½ å¯ä»¥ä½¿ç¨pip install requestsæ¥å®è£
requestsã
å½ä½ å¸æéåºå®¹å¨çshellç»ç«¯æ¶ï¼åªéè¦è¾å
¥exitå³å¯ã
å
³édocker容å¨
å¨å®ææ°æ®å¤çå·¥ä½ä¹åï¼ä½ å°±å¯ä»¥éè¿docker rm -f CONTAINER_IDæ¥åæ¢docker容å¨ãä½ åºè¯¥è¾å
¥ä¹åè·å¾ç容å¨ç¼ç ãå¦æä½ å¿äºï¼ä½ å¯ä»¥è¿è¡docker psæ¥çã容å¨åæ¢è¿è¡ä¹åï¼notebooksä¼ç»§ç»åæ¾å¨ä½ æ¬å°ç¨äºåæ¾çæ件夹ä¸ã
温馨提示:答案为网友推荐,仅供参考