Introduce
Python是一种强大的编程语言,其提供了很多用于科学计算的模块,常见的包括numpy、scipy和matplotlib。要利用Python进行科学计算,就需要一一安装所需的模块,而这些模块可能又依赖于其它的软件包或库,因而安装和使用起来相对麻烦。幸好有人专门在做这一类事情,将科学计算所需要的模块都编译好,然后打包以发行版的形式供用户使用,Anaconda就是其中一个常用的科学计算发行版
自带的包管理器conda也很强大。
主页地址:https://store.continuum.io/cshop/anaconda/
Getting Start
-
下载并安装Anaconda后,终端执行
conda list
可查看安装了哪些包 -
获取免费的学术License
申请地址:https://store.continuum.io/cshop/academicanaconda
使用edu
邮箱申请后,会在邮箱自动收到license_academic
文件,将其放在~/.continuum
目录下即可。 -
安装额外的包(命令行环境下执行)
<code class="language-shell hljs ruby has-numbering" style="display: block; padding: 0px; background: transparent; color: inherit; box-sizing: border-box; font-family: "Source Code Pro", monospace;font-size:undefined; white-space: pre; border-radius: 0px; word-wrap: normal;"><span class="hljs-variable" style="color: rgb(102, 0, 102); box-sizing: border-box;">$ </span>conda update conda <span class="hljs-variable" style="color: rgb(102, 0, 102); box-sizing: border-box;">$ </span>conda install accelerate <span class="hljs-variable" style="color: rgb(102, 0, 102); box-sizing: border-box;">$ </span>conda install iopro</code><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px; background-color: rgb(238, 238, 238); top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right: 1px solid rgb(221, 221, 221); list-style: none; text-align: right; opacity: 0.163836;"><li style="box-sizing: border-box; padding: 0px 5px;">1</li><li style="box-sizing: border-box; padding: 0px 5px;">2</li><li style="box-sizing: border-box; padding: 0px 5px;">3</li></ul><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px; background-color: rgb(238, 238, 238); top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right: 1px solid rgb(221, 221, 221); list-style: none; text-align: right;"><li style="box-sizing: border-box; padding: 0px 5px;">1</li><li style="box-sizing: border-box; padding: 0px 5px;">2</li><li style="box-sizing: border-box; padding: 0px 5px;">3</li></ul>
-
简单使用
编辑器中输入如下代码<code class="language-python hljs has-numbering" style="display: block; padding: 0px; background: transparent; color: inherit; box-sizing: border-box; font-family: "Source Code Pro", monospace;font-size:undefined; white-space: pre; border-radius: 0px; word-wrap: normal;"><span class="hljs-keyword" style="color: rgb(0, 0, 136); box-sizing: border-box;">from</span> mpl_toolkits.mplot3d <span class="hljs-keyword" style="color: rgb(0, 0, 136); box-sizing: border-box;">import</span> axes3d <span class="hljs-keyword" style="color: rgb(0, 0, 136); box-sizing: border-box;">import</span> matplotlib.pyplot <span class="hljs-keyword" style="color: rgb(0, 0, 136); box-sizing: border-box;">as</span> plt <span class="hljs-keyword" style="color: rgb(0, 0, 136); box-sizing: border-box;">from</span> matplotlib <span class="hljs-keyword" style="color: rgb(0, 0, 136); box-sizing: border-box;">import</span> cm fig = plt.figure() ax = fig.gca(projection=<span class="hljs-string" style="color: rgb(0, 136, 0); box-sizing: border-box;">'3d'</span>) X, Y, Z = axes3d.get_test_data(<span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">0.05</span>) ax.plot_surface(X, Y, Z, rstride=<span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">8</span>, cstride=<span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">8</span>, alpha=<span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">0.3</span>) cset = ax.contour(X, Y, Z, zdir=<span class="hljs-string" style="color: rgb(0, 136, 0); box-sizing: border-box;">'z'</span>, offset=-<span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">100</span>, cmap=cm.coolwarm) cset = ax.contour(X, Y, Z, zdir=<span class="hljs-string" style="color: rgb(0, 136, 0); box-sizing: border-box;">'x'</span>, offset=-<span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">40</span>, cmap=cm.coolwarm) cset = ax.contour(X, Y, Z, zdir=<span class="hljs-string" style="color: rgb(0, 136, 0); box-sizing: border-box;">'y'</span>, offset=<span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">40</span>, cmap=cm.coolwarm) ax.set_xlabel(<span class="hljs-string" style="color: rgb(0, 136, 0); box-sizing: border-box;">'X'</span>) ax.set_xlim(-<span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">40</span>, <span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">40</span>) ax.set_ylabel(<span class="hljs-string" style="color: rgb(0, 136, 0); box-sizing: border-box;">'Y'</span>) ax.set_ylim(-<span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">40</span>, <span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">40</span>) ax.set_zlabel(<span class="hljs-string" style="color: rgb(0, 136, 0); box-sizing: border-box;">'Z'</span>) ax.set_zlim(-<span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">100</span>, <span class="hljs-number" style="color: rgb(0, 102, 102); box-sizing: border-box;">100</span>) plt.show()</code><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px; background-color: rgb(238, 238, 238); top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right: 1px solid rgb(221, 221, 221); list-style: none; text-align: right; opacity: 0.163836;"><li style="box-sizing: border-box; padding: 0px 5px;">1</li><li style="box-sizing: border-box; padding: 0px 5px;">2</li><li style="box-sizing: border-box; padding: 0px 5px;">3</li><li style="box-sizing: border-box; padding: 0px 5px;">4</li><li style="box-sizing: border-box; padding: 0px 5px;">5</li><li style="box-sizing: border-box; padding: 0px 5px;">6</li><li style="box-sizing: border-box; padding: 0px 5px;">7</li><li style="box-sizing: border-box; padding: 0px 5px;">8</li><li style="box-sizing: border-box; padding: 0px 5px;">9</li><li style="box-sizing: border-box; padding: 0px 5px;">10</li><li style="box-sizing: border-box; padding: 0px 5px;">11</li><li style="box-sizing: border-box; padding: 0px 5px;">12</li><li style="box-sizing: border-box; padding: 0px 5px;">13</li><li style="box-sizing: border-box; padding: 0px 5px;">14</li><li style="box-sizing: border-box; padding: 0px 5px;">15</li><li style="box-sizing: border-box; padding: 0px 5px;">16</li><li style="box-sizing: border-box; padding: 0px 5px;">17</li><li style="box-sizing: border-box; padding: 0px 5px;">18</li><li style="box-sizing: border-box; padding: 0px 5px;">19</li><li style="box-sizing: border-box; padding: 0px 5px;">20</li></ul><ul class="pre-numbering" style="box-sizing: border-box; position: absolute; width: 50px; background-color: rgb(238, 238, 238); top: 0px; left: 0px; margin: 0px; padding: 6px 0px 40px; border-right: 1px solid rgb(221, 221, 221); list-style: none; text-align: right;"><li style="box-sizing: border-box; padding: 0px 5px;">1</li><li style="box-sizing: border-box; padding: 0px 5px;">2</li><li style="box-sizing: border-box; padding: 0px 5px;">3</li><li style="box-sizing: border-box; padding: 0px 5px;">4</li><li style="box-sizing: border-box; padding: 0px 5px;">5</li><li style="box-sizing: border-box; padding: 0px 5px;">6</li><li style="box-sizing: border-box; padding: 0px 5px;">7</li><li style="box-sizing: border-box; padding: 0px 5px;">8</li><li style="box-sizing: border-box; padding: 0px 5px;">9</li><li style="box-sizing: border-box; padding: 0px 5px;">10</li><li style="box-sizing: border-box; padding: 0px 5px;">11</li><li style="box-sizing: border-box; padding: 0px 5px;">12</li><li style="box-sizing: border-box; padding: 0px 5px;">13</li><li style="box-sizing: border-box; padding: 0px 5px;">14</li><li style="box-sizing: border-box; padding: 0px 5px;">15</li><li style="box-sizing: border-box; padding: 0px 5px;">16</li><li style="box-sizing: border-box; padding: 0px 5px;">17</li><li style="box-sizing: border-box; padding: 0px 5px;">18</li><li style="box-sizing: border-box; padding: 0px 5px;">19</li><li style="box-sizing: border-box; padding: 0px 5px;">20</li></ul>
下面就是spyder的主界面。变量查看窗口很好用,终端会做出图像。
-
更改工作目录
Tool->Preference—>Global working directory -
更换编辑器背景主题方案
Tool->Preference->Editor->Display 标签页
在Syntax color scheme
下拉菜单中选择Monokai
方案 -
更换IPython 终端背景
Tool->Preference->IPython console->Display 标签页
在Background color
选项里选择Dark backgroud
即可
经过简单的配置之后,集成化开发环境变得非常的 Cool
- 顶
- 1
- 踩