Problem Installing Python 3

I followed the prompt to download Python 3, but when I follow the instruction to write ‘python – version’, I am supposed to receive feedback about the version, and instead I get an error message stating:
Traceback (most recent call last):
File “<pyshell#2>”, line 1, in
python – version
NameError: name ‘python’ is not defined

Also, forgive me as I am very new to all of this, but I’m not sure if I’m even using the proper terminal. After downloading Python, on my laptop there is now:
IDLE (Python 3.9 64-bit) (this is what I was using that gave me the error)
Python 3.9 (64-bit)
Command Prompt
Powershell

Which one should I be using or does it matter?

Thank you for your help.

If you started with IDLE and you have a prompt like this >>> then you’re probably already running an interactive Python session. You could do something like-

import sys
print(sys.version)

To test the version whilst Python is running.

Using python --version or python -V is possible from a standard shell, e.g your command line (cmd.exe). Trying to invoke python from a running python session (e.g. with IDLE) would throw up errors like yours.

Thank you for the feedback.

This is the response I got from that input:
3.9.0 (tags/v3.9.0:9cf6752, Oct 5 2020, 15:34:40) [MSC v.1927 64 bit (AMD64)]

Again, because I’m new to this I’m relatively clueless as to what this means. I’m doing the command line course for some background but it hasn’t explained (at least yet) which of these terminals I should be using or how/if they differ. Given this response, am I okay to move forward with downloading miniconda and jupyter notebooks, and should I continue to use IDLE?

The version is right at the front, 3.9.0 so it seems fine to me :+1:.

If you do choose to install conda of some form then it bundles a version of Python with it anyway. It would be a different version than the one you have installed at present but they should be able to coexist peacefully so you don’t have to run around uninstalling things.

Since some of the early lessons do use JupyterNotebook files you would want to get jupyter installed. With Anaconda I think it is included. With miniconda you would have to install it via conda- conda install jupyter. Or if you choose not to get conda the standard python package manager pip would be the way to go pip install jupyter. If that’s all a bit confusing at present then stick with whatever the lessons suggest for now.

As for different terminals the command line course is based on bash which is well supported but depending on your OS may need some additional downloads for it to work in the same way the command line lessons would.

Since you have powershell I’m assuming you’re on windows. Whilst you could theoretically work with the basic command prompt shell many people would choose not to (you’d have to learn commands specific to this console). Since you’re doing the command line lessons there are several options to get a shell in windows which behaves like it does in the command line lessons.

I think the lessons themselves suggest git bash- https://www.codecademy.com/articles/command-line-setup
There are other popular options such as windows subsystem for linux (effectively lets you run a linux console semi-natively which would be my personal choice on windows). There are numerous online articles which suggest the benefits and drawbacks of different options but to keep things simple perhaps stick with what the lessons also cover for now and have a nosey at other options later on.

2 Likes