乐趣区

pycharm+docker的配置(含jupyter notebook的镜像run方法)

背景
搜了许多,都是较为陈旧的,目前 docker 的 mac 桌面版支持很快速的设置,不用找任何帮助
前提

假设你是想使用 docker 镜像,来避免 python 环境的复杂,节约时间的,来吧
因为我最近开始研究 ai,所以技术背景是 ai
docker pull ufoym/deepo:all-py36-jupyter-cpu
4 个多 G

申请 pycharm 专业版

0.0.0.0 account.jetbrains.com,添加到 hosts
pycharm,嗯,Activate code
G91XMO9AVI-eyJsaWNlbnNlSWQiOiJHOTFYTU85QVZJIiwibGljZW5zZWVOYW1lIjoic29uZyB3YW5nIiwiYXNzaWduZWVOYW1lIjoiIiwiYXNzaWduZWVFbWFpbCI6IiIsImxpY2Vuc2VSZXN0cmljdGlvbiI6IkZvciBlZHVjYXRpb25hbCB1c2Ugb25seSIsImNoZWNrQ29uY3VycmVudFVzZSI6ZmFsc2UsInByb2R1Y3RzIjpbeyJjb2RlIjoiSUkiLCJwYWlkVXBUbyI6IjIwMTktMDMtMDYifSx7ImNvZGUiOiJSUzAiLCJwYWlkVXBUbyI6IjIwMTktMDMtMDYifSx7ImNvZGUiOiJXUyIsInBhaWRVcFRvIjoiMjAxOS0wMy0wNiJ9LHsiY29kZSI6IlJEIiwicGFpZFVwVG8iOiIyMDE5LTAzLTA2In0seyJjb2RlIjoiUkMiLCJwYWlkVXBUbyI6IjIwMTktMDMtMDYifSx7ImNvZGUiOiJEQyIsInBhaWRVcFRvIjoiMjAxOS0wMy0wNiJ9LHsiY29kZSI6IkRCIiwicGFpZFVwVG8iOiIyMDE5LTAzLTA2In0seyJjb2RlIjoiUk0iLCJwYWlkVXBUbyI6IjIwMTktMDMtMDYifSx7ImNvZGUiOiJETSIsInBhaWRVcFRvIjoiMjAxOS0wMy0wNiJ9LHsiY29kZSI6IkFDIiwicGFpZFVwVG8iOiIyMDE5LTAzLTA2In0seyJjb2RlIjoiRFBOIiwicGFpZFVwVG8iOiIyMDE5LTAzLTA2In0seyJjb2RlIjoiR08iLCJw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bq23VmIqqDLgkNzuoog==

设置专业版

只有专业版有 docker 的 remote 调试,ce 版本没有
只需要进入 project 进行设置,如下图

可以采用另外一种方法:社区版在本地做实验,和学习,足够了
docker 镜像采用有 jupyterbook 的 images,全搞定
docker pull ufoym/deepo:all-py36-jupyter-cpu
或者
折扣申请
https://www.jetbrains.com/pyc…
也可以采用的最简便的:jupyter book
进入 pycharm,引用 numpy,如图,remote 包 ok 啦

jupyter notebook(使用 docker)

ZBMAC-C02N753CG:test jiaohuifeng$ ./jupyter.sh
[I 08:26:23.100 NotebookApp] Writing notebook server cookie secret to /root/.local/share/jupyter/runtime/notebook_cookie_secret
[W 08:26:23.537 NotebookApp] All authentication is disabled. Anyone who can connect to this server will be able to run code.
[I 08:26:23.552 NotebookApp] Serving notebooks from local directory: /root
[I 08:26:23.552 NotebookApp] 0 active kernels
[I 08:26:23.552 NotebookApp] The Jupyter Notebook is running at:
[I 08:26:23.553 NotebookApp] http://0.0.0.0:8888/
[I 08:26:23.553 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).

jupyter.sh
docker run -it -v /Users/jiaohuifeng/test:/sdata -p 8888:8888 –ipc=host ufoym/deepo:all-py36-jupyter-cpu jupyter notebook –no-browser –ip=0.0.0.0 –allow-root –NotebookApp.token= –notebook-dir=’/root’

退出移动版