Running Windows 10 python 3.8.1 - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: General Coding Help (https://python-forum.io/forum-8.html) +--- Thread: Running Windows 10 python 3.8.1 (/thread-24265.html) |
Running Windows 10 python 3.8.1 - quark80 - Feb-06-2020 I downloaded Python (3.8 64-bit)for Windows 10 & Windows Launcher, together with Manuals & Module Docs. The 'sys.path' is set to C:\Users\quark\AppData\Local\Programs\Python\Python38. Using: IDLE Python 3.8 64-bit: While the usual math operators e.g +.-, *, ** , min() , etc. work, 'def' is not recognised and math.pi generates: "Traceback (most recent call last): File "<pyshell#0>", line 1, in <module> math.pi NameError: name 'math' is not defined." Can someone tell me how to rectify these errors? RE: Running Windows 10 python 3.8.1 - snippsat - Feb-06-2020 math is a part of Python Standard Library. This mean that's there is no installation,but you need to import what needed.>>> import math >>> >>> math.pi 3.141592653589793 RE: Running Windows 10 python 3.8.1 - quark80 - Feb-06-2020 Unfortunately Idle(Python) does not recognise 'import'. RE: Running Windows 10 python 3.8.1 - snippsat - Feb-06-2020 What you mean bye does not recognize import ?IDLE has two parts when you start up you in interactive shell. Python 3.7.2 (tags/v3.7.2:9a3ffc0492, Dec 23 2018, 22:20:52) [MSC v.1916 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license()" for more information. >>> import math >>> >>> math.pi 3.141592653589793Running as script look a this image. Then code will be like this a file eg test_math.py ,no >>> and have to use print() .import math print(math.pi)
RE: Running Windows 10 python 3.8.1 - quark80 - Feb-07-2020 import SyntaxError: invalid syntax Running Windows 10 python 3.8.1 - quark80 - Feb-07-2020 I have noticed under the Python38 folder that the libs folder contains the items: _tkinter.lib; python3.lib; python38.lib; which are all quoted as Type VisualStudio.lib , an item I do not have on my computer. Can you tell me what Type they should be, please? RE: Running Windows 10 python 3.8.1 - jefsummers - Feb-07-2020 Can you copy and paste, using the bbs python tags, the line where you get the error and then the complete error message? It may be something simple. RE: Running Windows 10 python 3.8.1 - snippsat - Feb-07-2020 (Feb-07-2020, 11:59 AM)quark80 Wrote: importYes that would be SyntaxError,can not have import alone. >>> import File "<interactive input>", line 1 import ^ SyntaxError: invalid syntax # Must tell what to import >>> import math >>> >>> math.pi 3.141592653589793 (Feb-07-2020, 11:59 AM)quark80 Wrote: have noticed under the Python38 folder that the libs folder contains the items:It's just that Windows file associations point it to VisualStudio,this have nothing to say as you shall never open these files. lib files are static libraries that Python use internally eg _tkinter.lib is a libary file for the build GUI in Python tkinter.
RE: Running Windows 10 python 3.8.1 - quark80 - Feb-08-2020 It looks as if the other Items on my computer are interfering with the running of Python. Thanks to all for your suggestions. I have now stopped trying to run Python. |