PDA

View Full Version : Installing and running Python programs



Tyler Durden
12-24-2018, 11:16 AM
Hi guys,
Lately I've witnessed quite a few questions from folks regarding running python programs.
I didn't see a guide for the same so I decided to make one myself.
I will be setting up python 2 as well as python 3.
Feedback is appreciated as it helps me improve future guides :)

Here we go :

Download python installers from their official site.
[Only registered and activated users can see links]
Kindly refer to the screenshots for the same.
Kindly note I will be using python 3.6 for this guide as it has tensorflow support.
Select exe or msi installer for x86-64
[Only registered and activated users can see links]
[Only registered and activated users can see links]
[Only registered and activated users can see links]
[Only registered and activated users can see links]

([Only registered and activated users can see links])
Now install the files you downloaded from above, once again refer to the screenshots, the selection must be as shown in the screenshots.
in place of Jack whatever your username on your computer is will be there, Eg: Katie or Mark
[Only registered and activated users can see links]
([Only registered and activated users can see links])
Make sure to click on the disable path length limit option. Select it.
[Only registered and activated users can see links]
[Only registered and activated users can see links]
[Only registered and activated users can see links]
[Only registered and activated users can see links]

([Only registered and activated users can see links])
Now we will be renaming some files to python2 and python3 to be more systematic.
Eg: In python 2.7 installation folder I will rename python.exe to python2.exe
Similarly in python 3 installation folder I will rename python.exe to python3.exe
[Only registered and activated users can see links]
[Only registered and activated users can see links]
[Only registered and activated users can see links]
[Only registered and activated users can see links]

([Only registered and activated users can see links])
Next, we will be adding them to our file path.
Click on the windows button at bottom left of page and type System Environment Variables.
An option should show, click on it.
[Only registered and activated users can see links]
[Only registered and activated users can see links]
[Only registered and activated users can see links]

([Only registered and activated users can see links])
Now click on New and enter the paths, follow the screenshots for guidance. Remember the sequence Red -> Green ->Orange.
New -> Copy Paste the path -> Ok
Refer to the screenshots for the same.
[Only registered and activated users can see links]

Open a new file explorer window and go to the python2 install path.
[Only registered and activated users can see links]

Right click on the file
[Only registered and activated users can see links]
[Only registered and activated users can see links]


Copy the path and paste it after selecting new
[Only registered and activated users can see links]

Repeat for Scripts Folder
[Only registered and activated users can see links]
[Only registered and activated users can see links]
[Only registered and activated users can see links]
[Only registered and activated users can see links]

([Only registered and activated users can see links])
Repeat Step 5 for python3 , just remember it's installed at another place, refer to the below screenshot for the same
[Only registered and activated users can see links]

([Only registered and activated users can see links])
After setting the build paths correctly it should show like this
[Only registered and activated users can see links]

([Only registered and activated users can see links])
Now lets run a program and see. First navigate to the program folder that you want to run. Then Press and hold SHIFT key and right click. It should show the below options. Kindly note powershell is similar to cmd with some extra features, so it's better if you use it.
[Only registered and activated users can see links]

([Only registered and activated users can see links])
Pip is something we will use to install python modules such as Pillow, mechanize, etc. Lets now first make sure PIP is upto date else it will give error saying "Unable to create process using '''' "
Run the following 2 commands
python2 -m pip install --upgrade pip
python3 -m pip install --upgrade pip
Kindly refer to the screenshots for the same.
[Only registered and activated users can see links]
[Only registered and activated users can see links]

pip2 is for python2 and pip3 for python3 . To install a module simply run pip2 install "modulenameherewithoutquotes" or pip3 install "modulenameherewithoutquotes".
Here is an example:
[Only registered and activated users can see links]

([Only registered and activated users can see links])
Now lets finally run the program.
Remember to run a python 2 program type
python2 "filenamewithoutquotes".py
and for python3
python3 "filenamewithoutquotes".py
Make sure you are in the same directory as the file you are running.
To go to a particular directory type
cd "directorypathherewithoutquotes"
Eg: cd C:/Python

Here is an example of me running DailyDoer while being in the same directory
python2 DailyDoer.py
[Only registered and activated users can see links]

([Only registered and activated users can see links])
That's it folks. That's how to install python and run python programs.




If you have any suggestions or need help, feel free to reach out to me, I'm happy to help and constructive feedback is welcome :)
Update: Added commands and more explanation for easier understanding.

j03
12-24-2018, 11:27 AM
Thanks for sharing this guide! I'm sure it'll help many of those interested in the Python programs released here but not sure how to get them to run. Even if they want to get the second Python version.

Using an external site like Dropbox or imgur will work better for images.


Sent from my iPhone using Tapatalk

Tyler Durden
12-24-2018, 12:00 PM
Thanks for sharing this guide! I'm sure it'll help many of those interested in the Python programs released here but not sure how to get them to run. Even if they want to get the second Python version.

Using an external site like Dropbox or imgur will work better for images.


Sent from my iPhone using Tapatalk

Yep I'll do it later. Thanks :)

Mama Bear
12-24-2018, 04:43 PM
Yep I'll do it later. Thanks :)

If you post them in img tags within spoiler tags, it saves having to click links but doesn't stretch the page. ;)

Tyler Durden
12-25-2018, 02:14 AM
If you post them in img tags within spoiler tags, it saves having to click links but doesn't stretch the page. ;)
Tried it with img src. Not working :(
Thanks anyways I guess.

Update: Bacchus
[Only registered and activated users can see links](Please-Disregard)
It's increasing the number of clicks so I think it's best we go with it as it is.
Suggestions are welcome ofcourse :)

Bat
12-25-2018, 02:20 AM
Tried it with img src. Not working :(
Thanks anyways I guess.

The image pseudo-html looks like this: #URLHERE. You don't need to specify the src attribute. The source is read between the opening and closing tags.

Tyler Durden
12-25-2018, 02:36 AM
The image pseudo-html looks like this: #URLHERE. You don't need to specify the src attribute. The source is read between the opening and closing tags.
Nope man, not working. :/

Bat
12-25-2018, 02:54 AM
Nope man, not working. :/


That's really bizarre! When I submit this:

[Only registered and activated users can see links]


It's rendered like this:


[Only registered and activated users can see links]




So what Bacchus was suggesting is:

[Only registered and activated users can see links]


Which is rendered like this:

[Only registered and activated users can see links]

Tyler Durden
12-25-2018, 03:12 AM
That's really bizarre! When I submit this:



[Only registered and activated users can see links]


It's rendered like this:


[Only registered and activated users can see links]


[Only registered and activated users can see links]



[Only registered and activated users can see links]


Which is rendered like this:

[Only registered and activated users can see links]



Yep man, I know. It simply prints the tags and the url both.
Anyways, it's not impacting the guide significantly and I hope it helps many to get started with running programs in python :)