Having Trouble Setup Python Outside Codecademy For Project on Windows 10

I am trying to set up python outside Codecademy to do a project from one of my course.

This Is The Set Up Guide Link

I have troubles keeping up with what said there.

From the article, it said type “python” in “cmd” and test it. I did. Here is the result.

The code

 movies = ["SPN", "Hannibal", "Dexter"]

did not work.

Later I search for python alone and it showed “python Command Prompt” which looked a lot similar to the previous one and test the code. This time it work.

Which one is the one I should use?

I also set up the recommended text editor. Here is the test code.

The direction told me to run it from command prompt which I did. Here is the result.

I also tried using the other one. It is still not working. Here is the picture.

How do I solve this problem?

so you can access the IDLE? (last screenshot)

try the following commands:

where python
where python2
where python3

to see if python is in path (it seems to be, given you accessed the IDLE, or did you have to navigate to the right directory for that? )

in the IDLE (with the >>>) you can run python code, not python script (you could import scripts though)


I had to navigate to it. By the way, I got this one and the other one (second picture with white background). The one in white pop up with IDLE.

The command prompt one seemed to be the only one that didn’t throw me syntax error. Here is the picture.

Open your start menu or whatever it is these days, run either cmd.exe or powershell

One of your screenshots show that you have a python executable at c:/python27/python.exe, so that’s what you type in cmd.exe/powershell
If you want it to run a file instead of dropping into its interactive prompt, add a space and the name of your code file
c:/python27/python.exe name_of_my_code_file.py

If you run python’s installer again I believe there’s a checkbox for adding python to your PATH variable which lets you use just the executable name instead of the full path.

Also note that you’re mixing up cmd.exe and python commands a whole lot. Pay attention to which of them is currently running and which of them your commands are intended for.

1 Like

I’ll try as you suggested.

What are the different between them? The command line in windows is very confusing. Do you have any suggestion on how to learn a proper ways? The command line lesson here is based on Mac. As far as I googled any related windows commands, it was kinda confusing.

Shouldn’t matter since you’re probably only running one command: python

1 Like

I ran the python installer again and add python to my path. After that, I tried called it from cmd.exe and it worked. Here is the result.


At this point I have another question(s). Is this where I suppose to write the code or just use it to run the result of my code where I write somewhere else such as a text editor?

If you look at your first command, you told python to treat itself like a python file.
It’s not. If you open it in a text editor it’ll look mostly like gibberish, which is pretty much what python told you when you tried it. Always read error messages (I suspect most windows users have learned to avoid looking at them, well, too bad, that stops now, they are now talking to You specifically)

Code is usually placed in a file encoded as ascii or utf8, or what most would say: plain text file. You then run python and give it the location of that file

The interactive mode can be used as a calculator (It was a very long time ago that I used a dedicated calculator program, I run python instead)
It can also be used to try out operations before you put it in the rest of your code, and if you need to run those things in the context of your program then you can load the code from your file first, like this:

# stuff.py
a = 3
b = 7
$ python -i stuff.py
>>> a + b

-i is to tell python to drop into interactive instead of exiting

1 Like

Like so:


1 Like

Here is the result.

Now it works. At this point, do I have to test or do something else in setting up python on my windows beside pip? I will continue with pip by follow the direction from the link I talked about in my first post. I personally think it is done, but I just want to make sure I didn’t miss any important steps here. Do you have any suggestions or concerns or recommendations before I move on?

You may want to change your shell (cmd.exe) to the directory where your code is. That way you’d just type
python stuff.py (I think windows might add or match the .exe part by itself)
You’d do that with cd, or open it there in the first place

exit() is a bit annoying to type out. ctrl+D might exit for you.

If you start needing other tools than python, wsl or msys2 may provide a better environment. Otherwise it doesn’t matter, and it definitely doesn’t give you any immediate benefit, it’s more about learning to use things where they belong.
(What they do is basically to provide the non-windows equivalent of cmd.exe, along with most other things one would expect to find on a linux machine (or mac for that matter), to some extent you get to ignore that you’re using windows)

1 Like

What do you mean change directory? I’m new here. I’m not quite sure I understand the concept.

By the way, Ctrl+D did not work, but I think I saw somewhere that to exit is Ctrl+Z. The Ctrl+Z work, but it took me a while. The first time I tried I didn’t press Enter because I was panic with the symbol of Ctrl on the screen. It was


which I did not expect it to show in that form. I thought I typed the wrong key but I didn’t so I go with



To change the current directory, you use:

cd C:\My\dir


cd My\dir

The first example used the complete path to the directory while the the second only used the path relative to the current one. By specifying the path, you can avoid having to type very long commands. Let’s say you wanted to run this:

C:\Users\me\Desktop\setup.exe --no-admin

That’s a lot to type. If your current directory was C:\Users\me, you would just have to type:

Desktop\setup.exe --no-admin

It would be even shorter if your current directory was C:\Users\me\Desktop:

setup.exe --no-admin

On cmd, the current directory is generally displayed on the left side of the prompt.


Here the current directory is C:\Users\Aspire.
You can change your current directory with cd:

C:\Users\me>cd Desktop
C:\Users\me\Desktop>setup.exe --no-admin

Learning a bit about or powershell or cmd can be useful. Some useful commands are:
echo - Display text:

C:\Users\me>echo "This is some text."
This is some text.

dir - Display file and directories in the current directory or the directory specified:


I’m not sure if the output of the above command would look that way.
help - Display a list of valid commands. I’ve no example output for this one.

1 Like

I find it difficult to explain it in general terms because I don’t actually know the full implications of the current directory

But the idea as I understand it, is that each process has access to the information of where it was started from (in the file system) which allows them to figure out which files you mean when you only specify the base name (not full path) or a path relative to the current location. For example, the program ls lists files in the current directory. The way it figures out which that is, is by looking at its current directory (the user doesn’t have to tell it)

On non-windows systems ^D sends end-of-file, (in this case the file is the console input) which is a convenient way to tell python to stop reading and exit. As usual windows does its own thing there, I think you have to use Enter after ^Z too? ^D exits immediately (as long as there’s nothing currently typed)

A similar combination which I think works on windows as well is ^C which sends a signal to a process to stop, it’s like the X button on gui’s. If you accidentally wrote an infinite loop this is how you’d stop it, or anything that runs for a longer time that you’d want to stop. (If ^C can’t be used for copying text in a terminal this might be the reason why)

Commandline interfaces might seem cumbersome at first, but they’re quite capable. A lot of linux systems have rather poor graphical interfaces (if there’s any at all) because that’s an afterthought!

1 Like

Yes. I had to use Enter after ^Z, but the ^C doesn’t need the Enter after. It will exit or stop on its own.

Thank you, you all for the help. I really appreciate it. Without your help, I wouldn’t be able to install python properly.