我是这个py2exe的新手,
我的cmd.py中有我的脚本
public class Division {
public static void main(String[] args) {
Scanner input;
input = new Scanner(System.in);
System.out.print("Enter two positive intergers for division:\n");
int numerator = input.nextInt();
int numeratorprint = numerator;
int denominator = input.nextInt();
int quotient = 0;
int remainder = 0;
while ((numerator < 0) || (denominator < 0)) {
System.out.print("Enter two positive intergers for division:\n");
numerator = input.nextInt();
denominator = input.nextInt();
}
if (numerator == 0) {
System.out.print(numerator + "/" + denominator + " = " + numerator + " with a remainder of " + numerator);
} else {
if (denominator == 0) {
System.out.print("This result is undefined (Cannot divide by Zero)");
} else {
if (denominator > numerator) {
System.out.print("Cannot do proper fractions");
} else {
remainder = numerator % denominator;
quotient = ((numerator / denominator) - (remainder / denominator));
}
}
}
System.out.println(numeratorprint + " / " + denominator + " = " + quotient + " with a remainder of " + remainder);
}
}
setup.py,
import sys
for arg in sys.argv:
print arg
print "Hello World!"
将两个文件放在同一目录中,
我跑了,
from distutils.core import setup
import py2exe
setup(console=['cmd.py'])
并得到以下错误,
python setup.py py2exe
请提供帮助,提前致谢!
答案 0 :(得分:0)
检查你的python版本是否为3请用python版本2试试,因为py2exe是为python2开发的