访问网址:
https://tianchi.aliyun.com/
左侧可以理解为资源管理器,右上边是功能按钮,中间为代码管理区,下边为结果显示区
# 查看当前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.
# 安装拓展包#pip install some_package --user# 举例:安装sklearn某依赖库#!pip install sklearn2pmml --user以上注释清楚表明需要安装python包用法。因为本人不需要安装新的包。所以我在前面加了两个#作为注释,屏蔽了这2行代码
# 举例:绘图案例 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绘图的代码。
需要先安装扩展包:
pip install numpypip install matplotlibpip install scipypip install IPython
只需要在倒数第4行加入一句plt.show让Figure1绘图窗口显示就行了。点右下角磁盘图标可以保存图片。
联系客服