Installing Python 2 or 3 for Windows
I have used many methods of installing Python onto Windows 7 and 10. What works best for me all around is WinPython and it’s best feature is that it is portable. Portable meaning that you can use it on most USB sticks and run it from there or distribute along side your UBot Studio software. This is what sets WinPython apart from the rest. WinPython comes with many packages or just the standard libraries. The standard versions have “zero” in the installer filename. As far as I can tell Python 2 is only available in the zero form. Python 3 is available with tons of packages and modules in which I would recommend for any software developer for hassle free package/module installs. It also includes an Installer for installing those packages into the Zero distributions to send off to your users. It is by far the easiest way to package Python for use with your UBot Studio software. You can use there installer or if that is too large then you can trim it down if you wish and just use pip to install what you need after your installer install your UBot made software. Using this installer will eliminate package/module version issues and the need for a virtual environment.
Pay special attention to the architecture. You do want to use the correct one for your users. While UBot is 32bit you can still use 64bit Python this is also true for Iron Python. Iron Python has it’s own installer and it is the version UBot uses natively. If you do plan to use it you would want to install it on YOUR system in case some files are missing or corrupt inside the studio. Both Iron Python and WinPython are one click installs except Iron Python installs to its own particular directory while the WinPython installs to the directory the installer is located in.
Additional installs Windows distributions(compilers)
For Python 3.5+ – you will need to install Microsoft Visual C++ 2015 Redistributable
For Python 2 – you will need to install Microsoft Visual C++ Compiler for Python 2.7
How do I use Python/Iron Python in UBot Studio?
There are many but I will share two here. I made a tutorial in the UBot Forum how to run Python without a Plugin. The other way is to use the Execute Python Plugin (with 20 others) which has recently become available for free from the owner. Both ways allows you to use Python/Iron Python that has been installed. More importantly you be able to have the power/memory of 64bit at your fingertips!! You can even use Python/.NET GUI’s. Can you see how much more powerful your UBot software can be?
Inside the WinPython Package you get some extra goodies which you will see when you open the first folder. What I would like to point out first is the Jupyter Notebook. This is an IDE much like UBot in the sense that you can run nodes independently, these are called “cells” in the notebook. What is even cooler it has tab completion which is analogous to Intellisense in other programs like PyCharm or Visual Studio. For those that may wonder I use PyCharm as my main Python IDE. The notebook also allows you to do many other things like play sounds, view images and videos, HTML and make stunning tutorials. There are a plethora of notebooks on many subjects. The notebook started as a Python IDE but now has grown into many other languages over the years. Additionally you can use “IPython Widgets” which are GUI elements for input/output.
After you install the Python 2 WinPython you will need to do a couple of additional steps if you wish to use the Jupyter Notebook. You will need to “pip install jupyter” from the command line prompt. If you look inside your WinPython installation folder you will see the “WinPython Command Prompt” just click on this and you wont need to cd into the correct directory. Then you will need to “pip install ipykernel” and you should be good to go!. Note: this is where you would do most of your “pip” installs. This is the same for the “zero” WinPython Python 3.
This is my main python installation and how I develop on my machine. I have a Python 3.5 and the latest 3.6 with a Python 2. When I add them to the windows PATH I add python 3 first!! Because I use it the most. Then I add python 2. The reason being is I can just open a normal command prompt(win+cmd) and quickly use Python 3 whether it is to install a package or just use the interpreter. So, windows will recognize my Python 3 rather than 2. Works well for me rather than the other way around which may be best for others.
NOTE: The following only necessary for your developer machine.
Adding a PATH to the “system environment variable”
Shortcut- press the windows key, then type path, click the first or second option
Just double click on PATH in the top window and add your directory with the Python interpreter(.exe). Then add a ; to the end.
What it looks like on Win 7 and adding the first one to Win 10. Win 10 adding a second one will give you a list box, just click add in the top right.
I also add one for the Scripts directory too which is where pip is located.
Installing Python form Python.org
Obviously you can go this route too. The installers work fine but the issue is that your user may start messing with things and totally break your software. Of course you can use a virtual environment to help lower the risk but I like the self contained method using WinPython. However, you can install Python 3.6+ silently from the command line and they do have a way to create a distribution package where it will just provide the required packages/modules needed to run your software. Just look for alternative installations at python.org. I will probably add more to this section in the near future.
Jupytter Ipython Notebook in detail
Ipython Widgets – UI Elements