0%
Loading ...

Python learning resources

  • Idle – Python default developing environment. Upon installing python, it installed also Idle by default.
  • Visual studio 2017 (I prefer the community edition).
  • PyCharm – Most popular IDE for Python.
  • TK GUI for Python – Graphical User interface
  • Numpy – Run from command prompt “pip install numpy
  • Matplotlib – Run from command prompt “pip install matplotlib
  • OpenCV on windows for Python
    • Option 1 (windows)
      • pip install opencv-python
    • Option 2
    • Option 3
      • Run from command prompt “pip install numpy
        • Test Numpy with the following python command: print numpy.version.version
      • Download OpenCV and install
      • Goto installed openCV: opencv/build/python/2.7 folder.
      • Copy cv2.pyd to C:/Python27/lib/site-packeges.
      • Open Python IDLE and type following codes in Python terminal.
        • import cv2
        • print cv2.__version__
      • FFmpeg
        • Inside OpenCV directory: opencv\build\bin\opencv_ffmpeg320.dll copy to c:\python27 directory.
    • Option 4
    • Example Code:
      • Run example program to check it works, this program extracts frames from a video file:

        import numpy
        import cv2

        print numpy.version.version
        print cv2.__version__

        vidcap = cv2.VideoCapture(“PigeonVideo.mp4”)
        success,image = vidcap.read()
        count = 0
        success = True
        while success:
            success,image = vidcap.read()
            print ‘Read a new frame: ‘, success
            cv2.imwrite(“frame%d.jpg” % count, image)
            count += 1

  • Note: For every install, open command prompt as ADMINISTRATOR only.
  • Numpy install: pip3 install numpy
  • Install opencv
  • Tensorflow – An open-source software library for Machine Intelligence

(2017/09/29) Scenario that worked on the following steps has been done on blank Windows 10 v.1607:

  1. Install Nvidia graphics driver and make sure it has no errors.
  2. Install “Microsoft Visual C++ 2015 Redistributable Update 3
  3. Install Cuda 8 with patch.
  4. Install cuDNN 6.
  5. Install Python 3.5.4
  6. Download Tensorflow v0.12.0 or Tensorflow v1.0.1.
  7. Open Cmd-Terminal-Command prompt and install the downloaded wheel as follows:
    • cd
    • pip install tensorflow_gpu-0.12.0-cp35-cp35m-win_amd64.whl
  8. Open Python and run the following commands:
    • import tensorflow as tf
    • tf.__version__
  9. Case of error, run THIS python script.

The following steps has been done on blank Windows 10 v.1703:

  1. Make sure Python 3.5 is installed.
    1. Do not select customized installation.
    2. Check the checkbox of adding python to system path.
  2. pip install –upgrade Install tensorflow-gpu 
  3. Download and install CUDA (8.0)
  4. Download cuDNN (6.0)
  5. After Cuda installed then extract cuDNN and copy it over Cuda directory.
  6. Run python from command prompt.
  7. Try the following command:
  8. import tensorflow as tf
  9. If there are no errors then it works.
  10. If there are error then try:
    1. Download and install “Microsoft Visual C++ 2015 Redistributable Update 3
  11. Watch the following video for more details:
  12. Installing CPU and GPU TensorFlow on Windows
NoVersionPy 2.7Py 3.4Py 3.5Py 3.6Link
10.12.0CPU: Mac, Linux
GPU: Mac, Linux
CPU: Linux
GPU: Linux
CPU: Mac, Linux, Windows
GPU: Mac, Linux, Windows
20.12.1GPU:
Mac, Linux
GPU:
Linux
GPU:
Max, Linux, Windows
GPU:
Max, Linux
31.0.0GPU:
Max, Linux
GPU:
Linux
GPU:
Mac, Linux, Windows
GPU:
Mac, Linux
Link
41.0.1GPU: Mac, Linux,GPU: Mac, Linux,GPU: Mac, Linux, WindowsGPU: Mac, LinuxLink
51.2.1GPU:
Linux
GPU:
Linux
GPU:
Linux, Windows
GPU:
Linux, Windows
Link
61.3.0GPU:
Linux
GPU:
Linux
GPU:
Linux, Windows
GPU:
Linux, Windows
Link