Try renaming your file to something besides math.py
. You are trying to import the math
module, and Python is choking because it's trying to import itself, and there's no pi()
function defined. If you change your filename to something like py34_math_test.py
you should be all set.
Using Sublime Text 2 for Python 3.4 dev. Standard Libraries don’t work
-
16-07-2023 - |
문제
Why Python 3.4 standard libraries don’t work in Sublime Text?
Running (example in Mark Lutz book) in myth.py in SublimeText:
import math
math.pi
math.sqrt(9)
and get
Traceback (most recent call last):
File "/Users/*myusername*/Desktop/python/math.py", line 1, in <module>
import math
File "/Users/*myusername*/Desktop/python/math.py", line 2, in <module>
math.pi
AttributeError: 'module' object has no attribute ‘pi'
Do it in terminal or EDLE and all works fine!
해결책
제휴하지 않습니다 StackOverflow