Setting up Python in Windows 10

Installing Python under Windows 10 is fairly easy as long as you set up your system environment correctly. Here’s your quick guide:

  1. Visit the official Python download page and grab the Windows installer for the latest version of Python 3.
  2. Navigate to the folder where you saved the installation file. Right-click the installer and select “Run as Administrator.” Click “Yes” when Windows asks if you want the program to make changes to your computer. 
  3. The next dialog asks whether you want to “Install Now” or “Customize Installation.” First, check the boxes that say “Install launcher for all users” and “Add Python 3.9 to PATH”. Then, choose “Customize Installation.”
  4. On the next screen, check all boxes under “Optional Features.” Click next.
  5. Under “Advanced Options,” set the location where you want to install Python. I like to use a location I can easily find, such as:

That will remind me that I’ve installed Python 3.9.

Also under “Advanced Options,” check the following boxes:

  • “Install for all users”
  • “Associate files with Python”
  • “Create shortcuts for installed applications”
  • “Add Python to environment variables”
  • “Precompile standard library”
  1. Click through the dialog to finish the installation and exit the installer.

Testing Your Install

Now, to launch the Python interpreter from the command line, you can open a command prompt (Start Menu > Windows System > Command Prompt) and type:


That will load the Python interpreter:

Python 3.9.1 (tags/v3.9.1:1e5d33e, Dec 7 2020, 17:08:21) [MSC v.1927 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.

Because of the settings you chose during the install, you can now run this interpreter — and, more important, a script — from any directory on your system.

Type exit() and hit Return to exit the interpreter and get back to a C: prompt.

Optional: Set up useful Python packages

Python 3 comes with the package installer pip already in place, which makes it super easy to add useful packages to your Python installation. The syntax is this (replace package_name_here with the name of a package you want to install):

pip install package_name_here

Let’s add a couple of must-have utilities for web scraping: Requests and BeautifulSoup. You can use pip to install them all with one command:

pip install beautifulsoup4 requests

csvkit, which I covered here, is a great tool for dealing with comma-delimited text files. Add it:

pip install csvkit

You’re now set to get started using and learning Python under Windows 10. If you’re looking for a guide, start with the Official Python tutorial.

Like What You Read Here?
My book Practical SQL: A Beginner’s Guide to Storytelling with Data from No Starch Press offers a step-by-step guide learning SQL and working with relational databases. Learn how to wrangle the everyday data you encounter to gain meaningful insights.

94 responses to “Setting up Python in Windows 10”

  1. Justin says:

    During the install there is a checkbox that says “Add Python 3.5 to PATH.” Does this work rather than manually setting it in step 3 above?

  2. Justin says:

    To follow up, checking the box during the install seems to work, at least accessing Python through IDLE (I haven’t tried anything else).

    Thanks for the helpful instructions!

  3. Carlos says:

    Thanks man, I am new to Windows 10 and this was really helpful!

  4. waya says:

    Hallo, this has been very helpfull man. However, I got a problem with pip install some_package command…an error that says could not find a version that satisfies the requirement…any help please

  5. Anthony says:


    Replace some_package with an actual package name, such as csvkit.

  6. Philbert says:

    For me, the default install did not install it to C:\Python35, but to some deep AppData folder (C:\Users\Philbert\AppData\Local\Programs\Python to be exact)

    This annoyed me, so I uninstalled it and went for the custom install. There you get the choice to set the install folder (so I set it to C:\Python35) and as mentioned above, to have the installer create the environment variables (path) for you.

  7. Anthony says:


    Thanks for the heads-up on that. Looks like Python 3.5’s installer now offers that option, and I’ve made a change to the instructions.

  8. […] 3 donde se haya instalado. Para el caso de Windows 10 los pasos varían un poco, sin embargo este enlace muestra todos los pasos para esa […]

  9. Ann says:

    Thank you for sharing! I’m new to python and window 10. I found the following steps confusing:

    In the User Variables section, edit the PATH statement to add this (if there is no PATH variable, click NEW to create one):

    Do I suppose to create three user variables with different names? I try to create a variable named ‘PATH’, however, when I move to the next directory with the same name, it just clear the previous information. So I’m really confused about what I need to do. Could you provide a step by step instruction for this part? Thanks!

  10. Anthony says:


    I clarified the instructions in the post. Windows 10 presents one dialog if you’re creating a new PATH, and a different dialog if you’re editing a PATH. (At least that’s what I see on my system.)

  11. Philbert says:

    Awesome Anthony. This is the best how to on installing Python that I have seen.

  12. Vera says:

    thank you for that great instructions!!!

  13. Sam says:


    So in the event that I added the PATH variable, and it still doesn’t recognize it, what would you suggest?

    Python installed two directories: Python 3.5 and Python35-32, both in Program Files (x86). First I tried to have the installer add the path variables, but for some reason, that didn’t work. I then tried manually adding paths for 35-32, 3.5, and both at the same time, as the following line shows, but none of those worked. It still does not recognize “python” as an internal or external command.

    “C:\Program Files (x86)\Python35-32;C:\Program Files (x86)\Python35-32\Lib\site-packages;C:\Program Files (x86)\Python35-32\Scripts;C:\Program Files (x86)\Python 3.5;C:\Program Files (x86)\Python 3.5\Lib\site-packages;C:\Program Files (x86)\Python 3.5\Scripts”

    – Sam

  14. Anthony says:


    You definitely don’t want to have both installs in your PATH. Choose one and use that. Also, make sure you start a new command prompt after you make the change. If you have a command prompt active while you make the change, it won’t be recognized in the active prompt.

  15. Karl says:

    Was a little miffed it wasn’t working for me until I read your comment to Sam and remembered I had to reset my cmd. Works like a charm. Running my OS from an SSD and python from my HDD.

  16. Your instructions do not actually install PIP. The only thing they do is install the Python binary. When I try to run `pip`, I get an error “pip’ is not recognized as an internal or external command”.

  17. Anthony says:


    This tutorial focuses on Python 3, which includes pip:

    Did you install Python 3.5?

  18. Yes, but pip wasn’t part of it. I had to install it separately.

  19. Anthony says:


  20. Prajwal says:

    I changed the PATH variables and everything but yet when I type ‘python’ on the cmd it display ‘no such command found’. I am using windows 10

  21. Anthony says:


    Did you quit your command terminal and restart it?

  22. Cluley says:

    Hi, I just added 3.5. I selected the add to path option in the installation tool. It only added C:\Python35-32 and C:\Python34\Scripts\. So I have added C:\Python35-32\Lib\site-packages\ manually. Hopefully this will work.

  23. Anthony says:


    It would be odd to have both C:\Python35-32 and C:\Python34\ paths — that reflects two different versions. Edit to standardize on one or the other.

    Also, always quit and restart the command terminal to see changes take effect.

  24. Eshwar says:

    Thanks for this man.. However, I got a problem with pip install some_package command…an error that says could not find a version that satisfies the requirement.. I replaced some_packages to csvkit. Then also the same error continies. Can you please help me

  25. Anthony says:


    What happens when you simply type pip on the command line? If that works, what happens when you type pip search csvkit?

  26. Alex says:

    I have been trying to figure this out for a few days and that advanced options part really helped me! Thank you so much!!!!!

  27. Jack says:

    Um, I still can’t do this I set up the path to my documents and it didn’t work for setting path

  28. chad says:

    honestly….I have posted on stackO, etc and you my friend have been my salvation thank you so much for this.

  29. Mike Garrant says:

    After multiple install attempts I getting following when attempting to start python from command prompt:

    Fatal Python error: Py_Initialize: unable to load the file system codec
    Traceback (most recent call last):
      File "c:\Python35-32\lib\encodings\". line 31, in 
    zipimport.ZipImportError: can't find module 'codecs'
  30. Anthony says:


    Not quite sure what the issue is, but I suggest Googling the error message and trying a few things with your Python path. Start with:

  31. Edwin F, Meyer says:

    I can get to the Python shell by typing “python” at the C: prompt OK, but how do I get to the page where indents are automatic, and different colors appear for different types of words, etc.? “IDLE” is not recognized.

  32. Elise Hang says:

    I followed all the steps mentioned for installation of Python 3.5 and still pip doesn’t work for me. When i type pip in the terminal, it displays a message saying – name not defined and i have checked the other link as well. It’s simply not working.

  33. Anthony says:

    Did you close and re-open your terminal window? Also, confirm that your PATH settings are correct.

  34. Pranav says:

    thanks, it works fine.

  35. Matt says:

    I tried to pip install mechanize, beautiful soup, and requests, but I keep getting an invalid syntax message.

  36. Anthony says:

    Can you post the exact message here? Also, did you restart your terminal window?

  37. Matt says:

    I started it back up just now and typed in “pip install mechanize beautifulsoup4 requests” and it still gave me the message “syntaxerror: invalid syntax”.

  38. Anthony says:

    Are you running the command at your C: prompt or within the Python interpreter? pip should be run from your C: prompt (aka command line).

  39. Matt says:

    I’m not sure. Can you tell me how to get to c: prompt so that I’ll know for sure?

  40. Anthony says:


    It’s under Start Menu | Windows System | Command Prompt.

  41. Matt says:

    I couldn’t find that in my start menu, so, I searched and it came up. It all worked there. Thank you very much for your help.

  42. Jason says:

    Just wanted to say thanks for writing this tutorial. Brand new to python and after 2.5 hours of searching it was your tutorial that finally allowed me to install BeautifulSoup successfully.

  43. Anthony says:

    Jason: Glad to know this is helping people!

  44. Kavish says:

    Great tutorial Anthony!!
    Worked for me Thanks..

  45. oli says:

    Thank you.Worked like a charm.

  46. I have two different classes I’m taking and need both python 2.7 and 3.5. I’m not clear on how to install both and clean up the PATH to work correctly in Windows 10?

    I’m imagining installing to C:\Python27 and C:\Python35, what would I do to get the proper installation and PATH.

    From what I gather I should be able to run one or the other by adjusting something there so that from my CMD propmpt I’ll have something like C:\Users\chrisgrazioli>python27 to run 2.7
    C:\Users\chrisgrazioli>python to run 3.5

  47. Gene says:

    Everything seems to have installed properly based on your directions. Thank you!

  48. Anthony says:


    The easiest option is to install both versions and change your path statements when you need to use one version or the other.

    A second option, which requires more initial setup but makes life far easier, is to get familiar with setting up virtual environments. Check out virtualenv ( and virtualenvwrapper (

  49. Christopher Grazioli says:

    So I went ahead and downloaded the .msi for python 2.7 and 3.5. I ran 2.7 first and checked to add it to the path, then I installed 3.5 and checked to add that to the path. After install I ran a command prompt for “python” and it only runs 3.5. So I went into the C:\Python27 folder where I installed it and renamed the executable file: python.exe to python27. I thought I was home free when I typed “python27” in the command prompt and Python 2.7 fired right up, but I can’t get “pip” or “pip install [any package]” to run. I get, {Fatal error in launcher:unable to create process using ‘”‘} Anyone have any ideas on squaring this away

  50. Nasseef says:

    I followed the steps, but still it showsnot recognized

  51. YO says:

    Wow thanks!

  52. Frank Cook says:

    Hi Guys,

    I have Python 27 installed and some programs work but I can’t figure out how to get it read or view my windows 10 C: files, folders, and directories. Either I get an error message that the path is invalid or the shell comes up with a blinking >>>> and no response. I’ve confirmed the program ran because i added print “hello” and now it will say: Hello >>>> and nothing else.. Any ideas as other things work fine like a program to open web browsers etc.

  53. Anthony says:


    If you post some code and the specific steps you’re following, I (or other readers) can try to help.

  54. Karen says:


    This is an error. There should be a \ for the first part
    C:\Python35-32\; ….

    After I put in the \, then it worked beautifully for me! Now on to try the PIP stuff.

  55. Colin says:

    First rate thank you very much Anthony. I had a directory problem with Pip so I uninstalled the whole lot and followed your instructions to the letter. You have made my day.

  56. Jonathan Crego says:

    Thank you for this. I was able to get python running ONLY after reading you guide.

  57. Nick says:

    Thanks Anthony for taking the time to do this. Much appreciated.

  58. Grant says:

    Thank you for the simplistic and useful guide.

  59. […] installation from the command line. If you accidentally installed Python without checking the box, follow this tutorial to add python.exe to your system […]

  60. Manoswini says:

    Thanks Anthony. This discussion was quite helpful for beginners like me. Right now I have python 2. Should I go for python 3? Anyway. Thanks for this simple and clear descriptions.

  61. Anthony says:


    If you are starting out with Python, I’d suggest Python 3. It’s where the language is heading, and at beginning levels there’s not a vast difference between it and Python 2.

  62. Saad Arman says:

    Thank you very much it worked. I have a good grip on C++,Java, C# and other web languages but very new to python and python was giving me trouble in starting. Thank again. 🙂

  63. Thanks a lot for the nice and smooth instructions.

  64. Naeem says:

    Hello Im trying to install python for windows 10. I use pycharm and I configured python manually in pycharm. I want to install pygame and when I type into the cmd “python” it comes up with the not recognised message. . Python is in my C: and also I copied the same thing you said to do and still

  65. […] work, here’s how to change the PATH variable on Windows 10, which I found out thanks to this article. You’ll need to do this to get pip […]

  66. Jasmine says:

    Extremely helpful. Saved my day. Thank you so much!

  67. ute f says:

    Trying to learn python by running python 2.7.14 idle. Also trying 3.5 idle. Idle will not run. Both give same two error messages.

    Socket error: an attempt was made to access a socket in a way forbidden by its access permissions

    IDLE’s subprocess didnt make connection. Either Idle cannot stat a subprocess or a personal firewall software is blocking the connection.

    Have modified firewall to allow pythonw.exe both python 2.7 and 3.5.
    What to do next?

  68. ute f says:

    Left out info. Trying to run Python 2.7.14 and 3.5 in Win 10 ver 1607 os build 14393.1770

  69. Anna Marie Smith says:

    Very helpful. I have been happily using Python 3 on my Ubuntu Linux computers and I have been challenged but delighted with the results. Then I tried to install Python 3 on my Windows 10 laptop. First attempt was a mess. I edited, in the Environment Variables, the lower dialogue box, System Variables, and left the upper box, User Variables, unchanged. Open Command, type python at prompt, error message. Then I tried py at the prompt and there is was, the python 37 command line. But this was not really a solution. Next I downloaded Geany and tried to solve the problem by editing the Build Command dialogue box. More failures. So I uninstalled Python altogether. Then found this page, followed your instructions. I thought at first that nothing had changed, then I remembered, I need a fresh Command Prompt. Closed Command Prompt. Opened new one. My default in Command on Windows 10 is C:\Users\>
    This time, it responded to the full command term, python. Thanks so much !

  70. Alan Napier says:

    I would just like to say thank you for this tutorial.
    I found it faultless. Had to do a little more research but that was simply down to my own ignorance of the user variables.
    It was a trouble free start to python connectivity.

  71. Jacques Gekinet says:

    Very important for beginners like me wanted to learn Python which don’t know where to start and what to do. But with demonstration you have given to us are very helpful to learn Python. Only needed more details.
    Thanks to the group

  72. Aaron says:

    Wonderful! This made the process far easier than it was the last time I tried to make Python happen on Windows. Thank you for saving me… hours, maybe. If you had a tip jar on this blog, I’d donate.

  73. Anthony says:

    Glad it helped! If you’re interested in learning SQL, please check out my book “Practical SQL” from No Starch Press!

  74. ratchet says:

    thanks man…for the help..i was stuck for nearly 20 min in this

  75. Anthony says:

    Always glad to help!

  76. Nasri jr says:

    Thanks for help

  77. Ali says:

    If you are interested in learning more about Python 3, check out this link:
    Or, if you want a more in depth comparison of Python 2 and Python 3, check out this link:

  78. Student says:

    Hello, thank you for the tutorial. I ran into two problems and was hoping you could help. 1) I have followed the instructions for the PATH variable but still get the “python is an invalid command” error on my command prompt. I have tried restarting it. 2) When I open the Python app directly from the start menu and try to install the packages, I get a syntax error and it points to the last letter in “install”.

  79. Anthony says:

    Hi, Student,

    Unfortunately, it’s difficult for me to diagnose exactly what’s not working without seeing your machine. My best suggestion is to start from the beginning and work through each step to confirm you’ve done each one per the instructions. Typically, the error message you’re seeing indicates that either Python wasn’t installed or that it’s not on the PATH.

  80. sanjay says:

    Very useful, i searched almost for 24hrs for the step to installing python 3.7 on windows 10 and its pip packages for web scraping… i got all correct and useful information here

  81. Philip Peter Manavado says:

    Thank you! Works Great.

  82. Gagandeep Nagpal says:

    Great Article..

  83. Abhishek says:

    Perfect article !! Thanks a lot

  84. Rafaelonca says:

    Oh thanks man!
    I’m having trouble with the settings because I follow a tutorial saying to put ;%PYTHON_HOME% and thats no need to do this in windows 10.

    I’m newbie on windows, I’ve used mac for at least 10 years of my life… :p

  85. Dave says:

    Having the same syntax error as other users have mentioned, e.g.

    Python 3.7.3 (v3.7.3:ef4ec6ed12, Mar 25 2019, 22:22:05) [MSC v.1916 64 bit (AMD64)] on win32
    Type "help", "copyright", "credits" or "license" for more information.
    >>> pip install beautifulsoup4 requests
    File "", line 1
    pip install beautifulsoup4 requests
    SyntaxError: invalid syntax
    >>> pip install beautifulsoup4 requests
    File "", line 1
    pip install beautifulsoup4 requests
    SyntaxError: invalid syntax

  86. Dave says:

    The problem appears to be that pip was not installed with 3.7.3, e.g. checking for install showed not installed, and after installing pip (,

    > pip install beautifulsoup4 requests
    ...then worked fine

  87. Anthony says:

    You have to make sure that you check the option to install pip during the installation. This used to be automatic but now it’s a checkbox. I’ve modified the post to note this.

  88. HG says:

    Great tutorial!!! I had all the above problems, but followed a user’s advice above and removed my installation and followed your instructions. All went perfect!!! The default installation to AppData did not allow my environmental variables to work properly. However, your basic installation worked perfectly. Hopefully I can now import the OS module and run my program. I am new to Python, but not new to programming although I am far from being a programmer.

  89. Errol says:

    Hi, Anthony. I have a Windows 10 64-bit system. Can I install the latest version of Python on this system?

  90. Anthony says:


    Yes you can!

  91. Uday says:

    Thanks a lot! The most instructive how-to. Helped me.

  92. Father of Woe says:

    Thank-you! Great how-to. Uninstalled default – and frustrating – installation and re-installed Python following your advice. Works like a charm.

  93. Anthony says:

    Awesome, glad to hear it worked for you!

  94. Durai says:

    Thanks bro working

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.