If you wish to code in Python on Windows, then we are here to offer all the assistance you need regarding this.
First and foremost, we will see how you can install Python on Windows. Let’s take a look at the detailed instructions below.
- You need to download the latest version of Python first. You can download it from the official website. However, you have to make sure that it is indeed the latest one.
- Next up, you need to open the file you have just downloaded.
- Go for the default options while you install it. You successfully completed the installation!
Setting up Python
- You need to visit this particular folder next -> C:\Python27. As you can see, all the Python files are stored in this folder.
- Copy that address from the address bar. You may close the window now.
- You need to right click on My Computer next.
- Next up, you need to click on Properties. Thereafter, click on Advanced.
- Launch Environment Variables.
- You need to find the variable path next.
- Once you have found the path, you need to edit it by clicking on Edit.
- Use the right arrow to scroll to the extreme right of “Variable value” field.
- It’s time to append a semi-colon at the end. The path (of Python folder) needs to be pasted next to it. Now you need to click OK.
Writing Python Code for the first time
- You need to create a new folder to store all the Python programs you will be writing. You need to make sure that you create the folder on the C:\ drive.
- You need to launch the Run program. You can do it by visiting the Start. You might already come across Run there.
- Then you need to go to the field named Open. You need to type in “notepad” there.
Windows and Python
Windows doesn’t have pre-installed Python. You will have to download and install it manually. And we have already shared the details regarding the same above. While you install Python, you have to make sure that you follow the instructions to the T. One thing you always need to remember is the directory where you have installed Python. This information is crucial as you will be using this information a lot. For instance, all the Python scripts have this information at the top. If you are looking for more information regarding this, then you can visit Althow.
As far as writing Python programs are concerned, you can use a text editor. We recommend EditRocket since it is really good. Python scripts and programs usually come with the .py extension. The good thing about EditRocket is that it will recognize the files with .py extension. They will provide different colors to the code so that you will find it easy to work with it. If you wish to create a program in Python, then all that you are required to do is to create a file with .py extension. Then you can put some Python code to make it a legit Python file. If you wish to know more about install pip windows, then visit the link provided.
As far as executing the already written program, you can use the tools provided by EditRocket. Or you can simply make use of the command prompt for the same. You have to use cd command to go to the folder where you have kept the files with .py extension.
Configure the Apache Web Server
If you wish to run Python on Windows, then you need to configure the Apache Web Server first.
The first step is to install Python. We have discussed installation of Python already in this article. The most important thing you need to keep in mind is the directory where you have stored the Python files.
Next up, you need to open the apache configuration file httpd.conf. You can open it with EditRocket. Where can you find this file? Go to the install directory of Apache. You will find this particular file in the conf directory. You can simply search the file with the name.
Since Python doesn’t come with Windows, you will have to install it. You can download the file from the official website. Most importantly, you need to make sure that it is the latest file. Thereafter, install it by opting for the recommended options.