Using Visual C Build Tools instead of Visual Studio on Windows

matham edited this page Jan 24, 2017 · 2 revisions
Clone this wiki locally

MSVC

Environment

MSVC is used mainly to support Python 3.5 and higher versions. To compile for Python 3.5 there's more than one tool to use for compilation although the actually used compiler is basically the same. Visual C++ Build Tools is the smallest one among all of them. If you already have Visual Studio 2015 you do not need this guide and can instead compile normally.

  1. Get Visual C++ Build Tools (~5GB total size)

  2. Open cmd.exe in <python.exe folder> (shift + right click)

  3. Upgrade pip and setuptools*

  4. Get sdl2 and glew DLLs and headers:

    python -m pip install kivy.deps.sdl2 kivy.deps.glew
    python -m pip install kivy.deps.sdl2_dev kivy.deps.glew_dev
    
    :: optionally install GStreamer + headers
    python -m pip install kivy.deps.gstreamer kivy.deps.gstreamer_dev
    
  5. "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat"

    For 64bit add x64 at the end of the command. More options available with --help

  6. Set environment variables for compiler:

    set MSSdk=1
    set DISTUTILS_USE_SDK=1
    set LIB=%cd%\libs;%LIB%
    set INCLUDE=%cd%\include;%INCLUDE%
    
  7. Set environment variables for Kivy:

    set USE_SDL2=1
    set USE_GSTREAMER=0
    
    :: optionally
    set USE_GSTREAMER=1
    
  8. git clone https://github.com/kivy/kivy

*The setuptools Python package version must be at least 24.0. according to Python's wiki