My file is named "foo.py". It has only two lines.
import random
print(random.randint(10))
The error is...
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/random.py", line 45, in <module>
from math import log as _log, exp as _exp, pi as _pi, e as _e, ceil as _ceil
File "math.py", line 2, in <module>
from random import randint
ImportError: cannot import name randint
- I am one MacOS 10.14.6
- I note that I did not call random.randint() in this script, even though it showed up in the error text.
- I ran the script with $python
- My /usr/bin/python is linked to python 2.7
- I've tried this with python 3 as well, with the same error.
I've tried deleting random.pyc
Aucun commentaire:
Enregistrer un commentaire