“从随机导入randint”抛出“ImportError:'随机'中的错误幻数:b'\ x03 \ xf3 \ r \ n'”错误

时间:2016-08-02 17:30:32

标签: python python-3.x import runtime-error importerror

我有一个python脚本执行不正确的数学运算。 这是:

from random import randint
while 1==1:
    try:
        exp = input()
        if exp=="1+1":
            print("=3")
        else :
            answer = exp
            while answer == exp:
                answer = randint(0, exp+10)
            print(answer)
    except Exception as e:
        print(e)
        print(259)

当我运行它时,我收到一个错误:

Traceback (most recent call last):
  File "/Users/the_name_of_my_home_folder/Documents/the name of the file.py", line 1, in <module>
    from random import randint
ImportError: bad magic number in 'random': b'\x03\xf3\r\n'

我在mac上使用python 3.5.1。

0 个答案:

没有答案