Python Forum
Running Windows 10 python 3.8.1
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Running Windows 10 python 3.8.1
#1
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?
Reply
#2
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
Reply
#3
Unfortunately Idle(Python) does not recognise 'import'.
Reply
#4
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.141592653589793
Running 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)
Output:
3.141592653589793
Reply
#5
import
SyntaxError: invalid syntax
Reply
#6
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?
Reply
#7
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.
Reply
#8
(Feb-07-2020, 11:59 AM)quark80 Wrote: import
SyntaxError: invalid syntax
Yes 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:
_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?
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.
Reply
#9
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.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Python script running under windows over nssm.exe JaroslavZ 0 704 May-12-2023, 09:22 AM
Last Post: JaroslavZ
  batch file for running python scipt in Windows shell MaartenRo 2 1,884 Jan-21-2022, 02:36 PM
Last Post: MaartenRo
  Running this script on Windows? Winfried 2 2,312 May-15-2020, 01:39 PM
Last Post: Winfried
  running script from CLI in windows aster 6 3,465 Apr-08-2020, 07:10 PM
Last Post: aster
  running Python on Windows OS / IIS server ajetrumpet 4 3,349 Feb-02-2020, 05:55 PM
Last Post: ndc85430
  Keypress when running a python app in a console on windows Stephen 6 8,987 Apr-16-2019, 12:38 PM
Last Post: Stephen
  help need with running python script on remote windows machine onenessboy 2 11,102 Dec-14-2018, 03:02 PM
Last Post: onenessboy
  Installing and running a python web scraping app from github to a windows 8.1 system eugenioca 17 8,192 Oct-06-2018, 08:14 AM
Last Post: eugenioca
  [split] running .py files on Windows metulburr 7 5,272 Sep-14-2017, 09:16 PM
Last Post: sparkz_alot

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020