python中的渐近线

python中的渐近线,python,asymptote,Python,Asymptote,我最近尝试在python中使用渐近线。按照此处的指示:,在最底部,它表示将渐近线.py文件放在python路径上。我已经这样做了,但是当我尝试执行一些代码时,它给出了错误(python安装在C:\Python27中,而渐近线.py安装在C:\Python27\Lib\site包中): 渐近线.py中的代码粘贴在此处: # Python module to feed Asymptote with commands # (modified from gnuplot.py) from subproce

我最近尝试在python中使用渐近线。按照此处的指示:,在最底部,它表示将
渐近线.py
文件放在python路径上。我已经这样做了,但是当我尝试执行一些代码时,它给出了错误(python安装在
C:\Python27
中,而
渐近线.py
安装在
C:\Python27\Lib\site包中
):

渐近线.py中的代码粘贴在此处:

# Python module to feed Asymptote with commands
# (modified from gnuplot.py)
from subprocess import *
class asy:
    def __init__(self):
        self.session = Popen(['asy', '-quiet', '-interactive'], stdin=PIPE)
        self.help()
    def send(self, cmd):
        self.session.stdin.write(cmd+'\n')
        self.session.stdin.flush()
    def size(self, size):
        self.send("size(%d);" % size)
    def draw(self, str):
        self.send("draw(%s);" % str)
    def fill(self, str):
        self.send("fill(%s);" % str)
    def clip(self, str):
        self.send("clip(%s);" % str)
    def label(self, str):
        self.send("label(%s);" % str)
    def shipout(self, str):
        self.send("shipout(\"%s\");" % str)
    def erase(self):
        self.send("erase();")
    def help(self):
        print "Asymptote session is open.  Available methods are:"
        print "    help(), size(int), draw(str), fill(str), clip(str), label(str), shipout(str), send(str), erase()"
    def __del__(self):
        print "closing Asymptote session..."
        self.send('quit');
        self.session.stdin.close();
        self.session.wait()
if __name__=="__main__":
    g = asy()
    g.size(200)
    g.draw("unitcircle")
    g.send("draw(unitsquare)")
    g.fill("unitsquare, blue")
    g.clip("unitcircle")
    g.label("\"$O$\", (0,0), SW")
    raw_input("press ENTER to continue")
    g.erase()
    del g
我的代码:

from asymptote import *
g=asy()
g.size(200)
g.draw("unitcircle")
g.send("draw(unitsquare)")
g.fill("unitsquare, blue")
g.clip("unitcircle")
g.label("\"$O$\", (0,0), SW")
我知道
渐近线.py
仅用于将命令馈送到
asy.exe
,我的计算机上安装了
渐近线
。如何解决此错误

from asymptote import *
g=asy()
g.size(200)
g.draw("unitcircle")
g.send("draw(unitsquare)")
g.fill("unitsquare, blue")
g.clip("unitcircle")
g.label("\"$O$\", (0,0), SW")