首页 > 编程知识 正文

qpython,python文件不存在时创建文件

时间:2023-05-04 04:15:27 阅读:23581 作者:736

python安装目录中的Scripts下有两个文件: compile.py和usemodule.py。 其中,compile.py代码如下: import py _ compile py _ compile.com pile () ) uuususile )。

python安装目录中的Scripts下有两个文件: compile.py和usemodule.py。 其中,compile.py代码如下:

import py_compile

py _ compile.com pile (' use module.py ',' usemodule.pyc ' )。

在pythonwin上打开并运行compile.py时,将报告以下错误:

跟踪后退(mostrecentcalllast ) :

文件' c :python 32libsite-packagespython winpywinframeworkscript utils.py ',line 326,inrune

exec (代码对象,__main__.__dict__ )

file ' c :python 32scriptscompile.py ',line 9,in

编译py _ compile.com pile (usemodule.py ),usemodule.pyc ) use module.py

file ' c :python 32libpy _ compile.py ',line 111,in compile

withTokenize.open(file ) as f:

file ' c :python 32libtokenize.py ',line 346,in open

buffer=builtins.open(filename,' rb ' ) )。

io error : [ errno2] nosuchfileordirectory : ' use module.py '

但是,在cmd中,只要进入Scripts目录下运行compile.py就没有问题。

展开

版权声明:该文观点仅代表作者本人。处理文章:请发送邮件至 三1五14八八95#扣扣.com 举报,一经查实,本站将立刻删除。