0

I've already installed python3 on my computer. when I started a new Jupyter notebook I selected python 3 but now on the notebook, it is saying it isn't there

when I run this: print(python_version())

i get this error:

NameError Traceback (most recent call last) in ----> 1 print(python_version())

NameError: name 'python_version' is not defined

2
  • Try doing import sys; print(sys.version) Commented Jun 4, 2021 at 16:34
  • You need to specify the question to be useful Commented Jun 4, 2021 at 17:36

1 Answer 1

0

python_version() function is from platform module; So you have to import it first:

import platform
print(platform.python_version())

Another way to check python version is sys module:

import sys
print(sys.version)
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.