我安装了多个Python版本(2.7和3.4) 我想用指定版本的Python运行.pyc
#! C:\python34\python
import sys
print("Hello",sys.version.split()[0])
input()
这个sheebang在Windows上运行得很好,因为我使用pylauncher 所以我可以这样编译
^{pr2}$但是当我执行pyc文件时,sheebang无法识别。在
这是可行的,但我不想重复C:\python34\python
因为当前脚本已经在我在shebang中要求的Python版本下运行。
因此,我想让子程序从相同版本的Python开始。在
到目前为止,我试过:
#! C:\python34\python
import os
os.system("C:\python34\python print.pyc")
这将是完美的,但不喜欢pyc文件。下面的方法也不起作用:
exec( open('print.pyc').read() )
有人知道如何调用代码中的pyc文件吗?在
相关问题 更多 >
编程相关推荐