{"id":4662,"date":"2018-11-26T11:56:21","date_gmt":"2018-11-26T03:56:21","guid":{"rendered":"http:\/\/www.systemsci.org\/jinshanw\/?p=4662"},"modified":"2018-12-07T22:52:03","modified_gmt":"2018-12-07T14:52:03","slug":"sagemath-and-python-on-jupyter","status":"publish","type":"post","link":"https:\/\/www.systemsci.org\/jinshanw\/2018\/11\/26\/sagemath-and-python-on-jupyter\/","title":{"rendered":"SageMath and Python on Jupyter"},"content":{"rendered":"<p>SageMath \u662f\u4e00\u4e2a\u5f00\u6e90\u514d\u8d39\u7684\u6570\u5b66\u8f6f\u4ef6\uff0c\u7efc\u5408\u4e86\u5927\u91cf\u7684\u5f00\u6e90\u6570\u5b66\u8f6f\u4ef6\uff0c\u7528Python\u5f53\u505a\u8f6f\u4ef6\u57fa\u672c\u8bed\u8a00\u3002\u56e0\u6b64\uff0c\u53ef\u4ee5\u5728\u4f7f\u7528Python\u7684\u8fc7\u7a0b\u4e2d\uff0c\u628aSageMath\u5f53\u505a\u4e00\u4e2a\u989d\u5916\u529f\u80fd\u6a21\u5757\u6765\u7528\u3002\u5f53\u7136\uff0c\u5982\u679c\u662f\u7f16\u7a0b\u6765\u4f7f\u7528\uff0c\u5219\u8fd9\u6837\u7528\u5c31\u591f\u4e86\u3002\u4e0d\u8fc7\uff0cSageMath\u548cPython\u5408\u8d77\u6765\u8fd8\u53ef\u4ee5\u5f53\u505a\u201c\u8ba1\u7b97\u5668\u201d\u6765\u4f7f\u7528\u3002\u8fd9\u4e2a\u65f6\u5019\uff0c\u5c31\u6700\u597d\u6709\u4e00\u4e2a\u56fe\u5f62\u754c\u9762\uff0c\u5e76\u4e14\u80fd\u591f\u628a\u7ed3\u679c\u4e5f\u5728\u5fc5\u8981\u7684\u65f6\u5019\u505a\u56fe\u5f62\u5448\u73b0\uff0c\u6700\u597d\u8fd8\u80fd\u591f\u5206\u4eab\u3002<\/p>\n<p>Jupyter\u5c31\u662f\u8fd9\u6837\u4e00\u4e2a\u754c\u9762\u73af\u5883\u3002<\/p>\n<p>\u6709\u4e24\u4e2a\u65b9\u6cd5\u53ef\u4ee5\u901a\u8fc7Jupyter\u6765\u96c6\u6210\u4f7f\u7528SageMath\u548cPython\u3002<\/p>\n<ol>\n<li>\u7b2c\u4e00\uff0c\u5b89\u88c5\u5b8c\u6210SageMath\u4e4b\u540e\uff0c\u5728SageMath\u754c\u9762\u4e0b\u6253\u5f00Jupyter\u3002\u4f8b\u5982\uff0c$.\/SageMath\/sage -n jupyter\u3002\u524d\u9762\u7684SageMath\u662fSageMath\u7684\u5b89\u88c5\u76ee\u5f55\u3002SageMath\u81ea\u5e26\u4e86Jupyter\uff0c\u56e0\u6b64\uff0c\u4e0d\u7528\u91cd\u65b0\u5b89\u88c5Jupyter\u3002<\/li>\n<li>\u7b2c\u4e8c\uff0c\u5355\u72ec\u5b89\u88c5Jupyter\u548cSageMath\u3002\u5728Jupyter\u754c\u9762\u4e0b\u6253\u5f00SageMath\u3002\u4e3a\u4e86\u80fd\u591f\u8ba9Jupyter\u77e5\u9053SageMath\u5728\u54ea\u91cc\uff0c\u6211\u4eec\u9700\u8981\u5b89\u88c5\u4e00\u4e2aJupyter\u62d3\u5c55\u5305\uff0c\u901a\u8fc7\u4e0b\u9762\u7684\u547d\u4ee4\uff1a$sudo jupyter kernelspec install SageMath\/local\/share\/jupyter\/kernels\/sagemath\u3002\u5176\u4e2d\u7684SageMath\u662fSageMath\u7684\u5b89\u88c5\u76ee\u5f55\u3002\u4e4b\u540e\uff0c\u5c31\u53ef\u4ee5\u901a\u8fc7\u8fd0\u884cjupyter notebook\u6765\u5b9e\u73b0\u901a\u8fc7Jupyter\u6765\u4f7f\u7528SageMath\u548cPython\u4e86\u3002<\/li>\n<p>\u5982\u679c\u4f60\u8fd8\u60f3\u5728\u4efb\u610f\u7684\u76ee\u5f55\u4e0b\u90fd\u80fd\u591f\u901a\u8fc7\u8fd0\u884cjupyter notebook\u6765\u5b9e\u73b0\u901a\u8fc7Jupyter\u6765\u4f7f\u7528SageMath\u548cPython\uff0c\u5219\u8fd8\u9700\u8981\u4fee\u6539\u8def\u5f84\u8bbe\u5b9a\uff0c\u8ba9\u7cfb\u7edf\u77e5\u9053SageMath\u7684sage\u6587\u4ef6\u548cbin\u6587\u4ef6\u5b58\u5728\u54ea\u91cc\u3002\u4f8b\u5982\uff0c\u901a\u8fc7\u5728.bashrc\u4e2d\u589e\u52a0\u4e00\u884c\uff1aexport SAGE_ROOT=SageMath\u3002\u5176\u4e2dSageMath\u662fSageMath\u7684\u5b89\u88c5\u76ee\u5f55\uff0c\u4f8b\u5982\/opt\/SageMath\u3002\u4ee5\u53ca\u6dfb\u52a0\u8def\u5f84\uff0c\u4f8b\u5982 export Path=SageMath:$PATH \u6765\u5b9e\u73b0\u3002<\/p>\n<p>\u6ce8\u610f\uff0c\u8fd9\u662flinux\u7cfb\u7edf\uff0cPython\u662f\u9ed8\u8ba4\u7cfb\u7edf\u6027\u5b89\u88c5\u7684\u3002\u5982\u679c\u5176\u4ed6\u7cfb\u7edf\uff0c\u53ef\u80fd\u8fd8\u9700\u8981\u5728Jupyter\u4e0b\u914d\u7f6ePython\u3002<\/p>\n<p>\u5b89\u88c5\u4e00\u4e2a\u53ef\u4ee5\u5728\u7f51\u4e0a\u5b8c\u6210\u8fd9\u4e2a\u8ba1\u7b97\u2014\u2014\u901a\u8fc7Jupyter\u6765\u96c6\u6210\u4f7f\u7528SageMath\u548cPython\u2014\u2014\u7684\u670d\u52a1\u5668\u3002\u751a\u81f3\u53ef\u4ee5\u8003\u8651\u5efa\u4e00\u4e2a\u5305\u542b\u673a\u5668\u5b66\u4e60\u529f\u80fd\u7684\u670d\u52a1\u5668\uff0c\u4f8b\u5982\u901a\u8fc7anaconda\uff08\u53ef\u4ee5\u8fde\u63a5\u4e0aTensorFlow\u6216\u8005\u5176\u4ed6\u673a\u5668\u5b66\u4e60\u5305\uff09\u3002\u5982\u679c\u4f7f\u7528anaconda\u5219\u53ef\u4ee5\u91c7\u7528<a href=\"https:\/\/mirror.tuna.tsinghua.edu.cn\/help\/anaconda\/\" rel=\"noopener\" target=\"_blank\">\u6e05\u534eanaconda\u8f6f\u4ef6\u4ed3\u5e93<\/a>\u3002<\/p>\n<p>\u5982\u679c\u5e0c\u671b\u5176\u4ed6\u7528\u6237\u4e5f\u80fd\u591f\u4f7f\u7528\u8fd9\u4e2a\u5e26\u4e86SageMath\u5185\u6838\u7684jupyter notebook\uff0c\u5219\u8fd8\u9700\u8981\u5b89\u88c5JupyterHub\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>SageMath \u662f\u4e00\u4e2a\u5f00\u6e90\u514d\u8d39\u7684\u6570\u5b66\u8f6f\u4ef6\uff0c\u7efc\u5408\u4e86\u5927\u91cf\u7684\u5f00\u6e90\u6570\u5b66\u8f6f\u4ef6\uff0c\u7528Python\u5f53\u505a\u8f6f\u4ef6\u57fa\u672c\u8bed\u8a00\u3002\u56e0\u6b64\uff0c\u53ef &hellip; <a href=\"https:\/\/www.systemsci.org\/jinshanw\/2018\/11\/26\/sagemath-and-python-on-jupyter\/\" class=\"more-link\">\u7ee7\u7eed\u9605\u8bfb<span class=\"screen-reader-text\">\u201cSageMath and Python on Jupyter\u201d<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[10],"tags":[386,385],"_links":{"self":[{"href":"https:\/\/www.systemsci.org\/jinshanw\/wp-json\/wp\/v2\/posts\/4662"}],"collection":[{"href":"https:\/\/www.systemsci.org\/jinshanw\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.systemsci.org\/jinshanw\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.systemsci.org\/jinshanw\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.systemsci.org\/jinshanw\/wp-json\/wp\/v2\/comments?post=4662"}],"version-history":[{"count":8,"href":"https:\/\/www.systemsci.org\/jinshanw\/wp-json\/wp\/v2\/posts\/4662\/revisions"}],"predecessor-version":[{"id":4675,"href":"https:\/\/www.systemsci.org\/jinshanw\/wp-json\/wp\/v2\/posts\/4662\/revisions\/4675"}],"wp:attachment":[{"href":"https:\/\/www.systemsci.org\/jinshanw\/wp-json\/wp\/v2\/media?parent=4662"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.systemsci.org\/jinshanw\/wp-json\/wp\/v2\/categories?post=4662"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.systemsci.org\/jinshanw\/wp-json\/wp\/v2\/tags?post=4662"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}