[英]Ipython 2.0 notebook, matplotlib, --pylab
In the past I have run Ipython with the --pylab option. 过去,我使用--pylab选项运行Ipython。 The only way I have found to get the notebook to work without getting the message about the ill-effects of --pylab is to open the notebooks and then 我发现要使笔记本计算机正常工作而又未收到有关--pylab不良影响的消息的唯一方法是打开笔记本计算机,然后
> %matplotlib
> import matplotlib.pylab as pl
and then do 然后做
pl.plot(x,y)
I would like to put the two commands above in my 00-import.py rather than typing them into the beginning of each notebook Is there a better way to do this. 我想将上面的两个命令放在00-import.py中,而不是在每个笔记本的开头键入它们。是否有更好的方法来执行此操作?
Write in a terminal 在终端上写
ipython locate
this command will return a directory. 此命令将返回目录。 Inside that directory you will find the folder "profile_default/startup/" any Python script located in that directory will be read when ipython start. 在该目录内,您将找到文件夹“ profile_default / startup /”,当ipython启动时,将读取该目录中的所有Python脚本。 If you write a script with the following lines 如果您使用以下几行编写脚本
import numpy as np
import matplotlib.pyplot as plt
%matplotlib inline
you will get numpy, matplotlib and inline figures. 您将获得numpy,matplotlib和嵌入式数字。
Anyway, probably it is a good idea to read this . 不管怎样,大概是读一个好主意, 这个 。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.