访问网址: https://tianchi.aliyun.com/ 注册一个阿里云账号,或者使用阿里系其他账号登录,推荐使用chrome。在主页中找到'天池Notebook天池Notebook在线管理python项目(Draft),在线管理测试运行所需要数据集天池DSW(Data Science Workshop),就是这样一个在线界面:左侧可以理解为资源管理器,右上边是功能按钮,中间为代码管理区,下边为结果显示区 主要代码区显示:# 查看当前kernel下已安装的包 list packages!pip list --format=columnsPackage Version------------------------- -----------absl-py 0.11.0aliyun-python-sdk-core 2.13.5。。。。。。。WARNING: You are using pip version 21.0.1; however, version 21.2.2 is available.You should consider upgrading via the '/opt/conda/bin/python -m pip install --upgrade pip' command.
# 举例:绘图案例 an example of matplotlib%matplotlib inlineimport numpy as npimport matplotlib.pyplot as pltfrom scipy.special import jnfrom IPython.display import display, clear_outputimport timex = np.linspace(0,5)f, ax = plt.subplots()ax.set_title('Bessel functions')for n in range(1,10): time.sleep(1) ax.plot(x, jn(x,n)) clear_output(wait=True) display(f)# close the figure at the end, so we don't get a duplicate# of the last plotplt.close()这就是演示matplotlib绘图的代码。 如果在本机电脑测试,以上代码无法 运行。需要这样修改一下需要先安装扩展包:
只需要在倒数第4行加入一句plt.show让Figure1绘图窗口显示就行了。点右下角磁盘图标可以保存图片。 利用阿里天池Notebook强大的在线python平台,不仅可以在线学习、在线运行、更可以调动阿里云CPU来进行超大型计算。 |
|