-
Notifications
You must be signed in to change notification settings - Fork 45
Setting up Python on Windows 10 for Machine Learning
Here is a simple way to install Python on Windows 10 in a local directory.
No need to use any installers, or mess up with User or System variables (PATH, etc.).
Everything is done from a Windows 10 Command Prompt, using the built-in curl and tar commands.
Step 1: create a local directory, and get into it. For example:
c:
mkdir c:\local_tools
cd c:\local_tools
Step 2: download an "embedded Python distribution" with the curl command:
curl https://www.python.org/ftp/python/3.6.6/python-3.6.6-embed-amd64.zip --output python-3.6.6-embed-amd64.zip
Step 3: unzip the file into the directory Python3.6.6
mkdir Python3.6.6
tar xvf python-3.6.6-embed-amd64.zip -C Python3.6.6
cd Python3.6.6
This is how it will look like:

Step 4: edit the file python36_.pth. So, type
notepad python36._pth
and uncomment the last line import site. Then, save the file, and close notepad.
The file should be
python36.zip
.
# Uncomment to run site.main() automatically
import site
Now we have a very bare-bones ("embedded") Python installation!
Step 5: download get-pip.py (see also https://pip.pypa.io/en/stable/installing/)
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
This is how it will look like:

Step 6: install pip
.\python get-pip.py
Step 6: Using pip, install the packages we need: cntk-gpu, keras, tensorflow-gpu, etc.
cd Scripts
.\pip install cntk-gpu keras tensorflow-gpu tqdm pillow matplotlib pyqt5 pyside2 opencv-python pythonnet
Here's the corresponding screenshot:

Step 7: configure matplotlib to use the Qt5Agg backend. This is done by editing the file
C:\local_tools\Python3.6.6\lib\site-packages\matplotlib\mpl-data\matplotlibrc. Just open the file, and make the
following edit:
#backend : TkAgg
backend : Qt5Agg