打开安装python文件?

问题描述

我最近下载了由 Matthieu Amiguet (http://www.matthieuamiguet.ch/pages/compilateurs) 开发的 VSL 编译器,以学习如何使用 Python PLY 进行编译。在自述文件中,它说键入 python setup install。我重新修改代码以在 python 3 中工作。这是我得到的错误

enter image description here

这里是 setup.py

import sys,os,shutil

def install():
    print ('Installing...')
    if not os.path.exists(vsldir): os.mkdir(vsldir)
    pyfiles = [f for f in os.listdir('VDK/src/') if not os.path.isdir(f) and f.endswith('.py')]
    for p in pyfiles:
        shutil.copy('VDK/src/'+p,vsldir)
    shutil.copy('VDK/bin/vslc',INSTALLDIR)
    shutil.copy('VRE/vsl',INSTALLDIR)
    shutil.copy('vmake/vmake',INSTALLDIR)
    os.chmod(INSTALLDIR+'vslc',111)
    os.chmod(INSTALLDIR+'vsl',111)
    os.chmod(INSTALLDIR+'vmake',111)
    print ('Installed!')

def uninstall():
    print ('Desinstalling...')
    if os.path.exists(vsldir): os.system('rm -R '+vsldir)
    if os.path.exists(INSTALLDIR+'vslc'): os.system('rm '+INSTALLDIR+'vslc')
    if os.path.exists(INSTALLDIR+'vsl'): os.system('rm '+INSTALLDIR+'vsl')
    if os.path.exists(INSTALLDIR+'vsl'): os.system('rm '+INSTALLDIR+'vmake')
    print ('Desinstalled!')

def printHelp():
    print ('''usage : python setup.py COMMANDE
            - install : installation of the compiler and runtime environement
            - uninstall : uninstall the compiler et the runtime environement
                (this two last command need root password)''')

if __name__ == '__main__':
    pythonpath = [path for path in sys.path if path.find('python')!=-1 and path.find('site-packages')!=-1]
    print ('========================================'.center(80))
    print ('=====         VSL Compiler         ====='.center(80))
    print ('===== David Jacod,Anthony Mougin ====='.center(80))
    print ('========================================'.center(80))
    if len(pythonpath)==0:
        print (' * No python path found. Installation Failed')
        sys.exit(-1)

    if os.name=='posix': INSTALLDIR = '/usr/local/bin/'
    elif os.name=='nt': INSTALLDIR = 'c:/VSLCompiler/'

    pythonpath=pythonpath[0]
    vsldir = pythonpath+'/vslcomp/'
    if len(sys.argv)<=2:
        if sys.argv[1]=='install': install()
        elif sys.argv[1]=='uninstall': uninstall()
        else: printHelp()
    else:
        printHelp()

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)