Как установить kivy python на windows

Table Of Contents

  • Installing Kivy
    • Using pip
      • Setup terminal and pip
      • Create virtual environment
      • Install Kivy
        • Pre-compiled wheels
        • From source
        • Pre-release, pre-compiled wheels
        • Development install
      • Checking the demo
    • Installation using Conda
    • Installing Kivy’s dependencies
    • Python glossary
      • Installing Python
      • How to use the command line
      • What is pip and what are wheels
      • What are nightly wheels

Installation for Kivy version 2.2.1. Read the changelog here.
For other Kivy versions, select the documentation from the dropdown on the top left.

Kivy 2.2.1 officially supports Python versions 3.7 — 3.11.

Platform

Installation

Packaging

w_logo

Windows

pip

PyInstaller

m_logo

macOS

pip, Kivy.app

Kivy.app, PyInstaller

l_logo

Linux

pip, PPA

b_logo

*BSD (FreeBSD,..)

pip

r_logo

RPi

pip

a_logo

Android

python-for-android

python-for-android

i_logo

iOS

kivy-ios

kivy-ios

c_logo

Anaconda

conda

Using pip¶

The easiest way to install Kivy is with pip, which installs Kivy using either a
pre-compiled wheel, if available, otherwise from source (see below).

Kivy provides pre-compiled wheels for the supported Python
versions on Windows, macOS, Linux, and RPi.

If no wheels are available pip will build the package from sources (i.e. on *BSD).

Alternatively, installing from source is required for newer Python versions not listed
above or if the wheels do not work or fail to run properly.

On RPi, when using a 32 bit OS, wheels are provided for Python 3.7 (Raspberry Pi OS Buster) and Python 3.9 (Raspberry Pi OS Bullseye),
via the PiWheels project. For other Python versions, on 32 bit OSes, you will need to
install from source.

Setup terminal and pip¶

Before Kivy can be installed, Python and pip needs to be pre-installed.
Then, start a new terminal that has
Python available. In the terminal, update pip and other installation
dependencies so you have the latest version as follows (for linux users you may have to
substitute python3 instead of python and also add a --user flag in the
subsequent commands outside the virtual environment):

python -m pip install --upgrade pip setuptools virtualenv

Create virtual environment¶

Create a new virtual environment
for your Kivy project. A virtual environment will prevent possible installation conflicts
with other Python versions and packages. It’s optional but strongly recommended:

  1. Create the virtual environment named kivy_venv in your current directory:

    python -m virtualenv kivy_venv
    
  2. Activate the virtual environment. You will have to do this step from the current directory
    every time you start a new terminal. This sets up the environment so the new kivy_venv
    Python is used.

    For Windows default CMD, in the command line do:

    kivy_venv\Scripts\activate
    

    If you are in a bash terminal on Windows, instead do:

    source kivy_venv/Scripts/activate
    

    If you are in linux or macOS, instead do:

    source kivy_venv/bin/activate
    

Your terminal should now preface the path with something like (kivy_venv), indicating that
the kivy_venv environment is active. If it doesn’t say that, the virtual environment
is not active and the following won’t work.

Install Kivy¶

Finally, install Kivy using one of the following options:

Pre-compiled wheels¶

The simplest is to install the current stable version of kivy and optionally kivy_examples
from the kivy-team provided PyPi wheels. Simply do:

python -m pip install "kivy[base]" kivy_examples

This also installs the minimum dependencies of Kivy. To additionally install Kivy with
audio/video support, install either kivy[base,media] or kivy[full].
See Kivy’s dependencies for the list of selectors.

From source¶

If a wheel is not available or is not working, Kivy can be installed from source
with some additional steps. Installing from source means that Kivy will be installed
from source code and compiled directly on your system.

First install the additional system dependencies listed for each platform:
Windows, macOS,
Linux, *BSD,
RPi

Note

In past, for macOS, Linux and BSD Kivy required the installation of the SDL dependencies from package
managers (e.g. apt or brew). However, this is no longer officially supported as the version
of SDL provided by the package managers is often outdated and may not work with Kivy as we
try to keep up with the latest SDL versions in order to support the latest features and bugfixes.

You can still install the SDL dependencies from package managers if you wish, but we no longer
offer support for this.

Instead, we recommend installing the SDL dependencies from source. This is the same process
our CI uses to build the wheels. The SDL dependencies are built from source and installed into a
specific directory.

With all the build tools installed, you can now install the SDL dependencies from source for SDL support
(this is not needed on Windows as we provide pre-built SDL dependencies for Windows)

In order to do so, we provide a script that will download and build the SDL dependencies
from source. This script is located in the tools directory of the Kivy repository.

Create a directory to store the self-built dependencies and change into it:

mkdir kivy-deps-build && cd kivy-deps-build

Then download the build tool script, according to your platform:

On macOS:

curl -O https://raw.githubusercontent.com/kivy/kivy/master/tools/build_macos_dependencies.sh -o build_kivy_deps.sh

On Linux:

curl -O https://raw.githubusercontent.com/kivy/kivy/master/tools/build_linux_dependencies.sh -o build_kivy_deps.sh

Make the script executable:

chmod +x build_kivy_deps.sh

Finally, run the script:

The script will download and build the SDL dependencies from source. It will also install
the dependencies into a directory named kivy-dependencies. This directory will be used
by Kivy to build and install Kivy from source with SDL support.

Kivy will need to know where the SDL dependencies are installed. To do so, you must set
the KIVY_DEPS_ROOT environment variable to the path of the kivy-dependencies directory.
For example, if you are in the kivy-deps-build directory, you can set the environment
variable with:

export KIVY_DEPS_ROOT=$(pwd)/kivy-dependencies

With the dependencies installed, and KIVY_DEPS_ROOT set you can now install Kivy into the virtual environment.

To install the stable version of Kivy, from the terminal do:

python -m pip install "kivy[base]" kivy_examples --no-binary kivy

To install the latest cutting-edge Kivy from master, instead do:

python -m pip install "kivy[base] @ https://github.com/kivy/kivy/archive/master.zip"

If you want to install Kivy from a different branch, from your forked repository, or
from a specific commit (e.g. to test a fix from a user’s PR) replace the corresponding
components of the url.

For example to install from the stable branch, the url becomes
https://github.com/kivy/kivy/archive/stable.zip. Or to try a specific commit hash, use e.g.
https://github.com/kivy/kivy/archive/3d3e45dda146fef3f4758aea548da199e10eb382.zip

Pre-release, pre-compiled wheels¶

To install a pre-compiled wheel of the last pre-release version of Kivy, instead of the
current stable version, add the --pre flag to pip:

python -m pip install --pre "kivy[base]" kivy_examples

This will only install a development version of Kivy if one was released to
PyPi. Instead, one can also install the
latest cutting-edge Nightly wheels from the Kivy server with:

python -m pip install kivy --pre --no-deps --index-url  https://kivy.org/downloads/simple/
python -m pip install "kivy[base]" --pre --extra-index-url https://kivy.org/downloads/simple/

It is done in two steps, because otherwise pip may ignore the wheels on the server and install
an older pre-release version from PyPi.

Development install¶

Note

We suggest to select master or relevant branch/version of doc from top left,
ensuring correct version/branch of kivy git repository you are working with.

If you want to edit Kivy before installing it, or if you want to try fixing some Kivy issue
and submit a pull request with the fix, you will need to first download the Kivy source code.
The following steps assumes git is pre-installed and available in the terminal.

The typical process is to clone Kivy locally with:

git clone https://github.com/kivy/kivy.git

This creates a kivy named folder in your current path. Next, follow the same steps of the
Installing from source above, but instead of installing Kivy via a
distribution package or zip file, install it as an
editable install.

In order to do so, first change into the Kivy folder you just cloned::
and then install Kivy as an editable install:

cd kivy
python -m pip install -e ".[dev,full]"

Now, you can use git to change branches, edit the code and submit a PR.
Remember to compile Kivy each time you change cython files as follows:

python setup.py build_ext --inplace

Or if using bash or on Linux, simply do:

to recompile.

To run the test suite, simply run:

or in bash or Linux:

On *BSD Unix remember to use gmake (GNU) in place of make (BSD).

Checking the demo¶

Kivy should now be installed. You should be able to import kivy in Python or,
if you installed the Kivy examples, run the demo.

on Windows:

python kivy_venv\share\kivy-examples\demo\showcase\main.py

in bash, Linux and macOS:

python kivy_venv/share/kivy-examples/demo/showcase/main.py

on *BSD Unix:

python3 kivy_venv/share/kivy-examples/demo/showcase/main.py

The exact path to the Kivy examples directory is also stored in kivy.kivy_examples_dir.

The 3d monkey demo under kivy-examples/3Drendering/main.py is also fun to see.

Installation using Conda¶

If you use Anaconda, you can
install Kivy with its package manager Conda using:

conda install kivy -c conda-forge

Do not use pip to install kivy if you’re using Anaconda, unless you’re installing from source.

Installing Kivy’s dependencies¶

Kivy supports one or more backends for its core providers. E.g. it supports glew, angle,
and sdl2 for the graphics backend on Windows. For each category (window, graphics, video,
audio, etc.), at least one backend must be installed to be able to use the category.

To facilitate easy installation, we provide extras_require
groups
that will install selected backends to ensure a working Kivy installation. So one can install
Kivy more simply with e.g.«pip install “kivy[base,media,tuio]”«. The full list of selectors and
the packages they install is listed in
setup.py. The exact packages in each selector
may change in the future, but the overall goal of each selector will remain as described below.

We offer the following selectors:

base: The minimum typical dependencies required for Kivy to run,

not including video/audio.

media: Only the video/audio dependencies required for Kivy to

be able to play media.

full: All the typical dependencies required for Kivy to run, including video/audio and

most optional dependencies.

dev: All the additional dependencies required to run Kivy in development mode

(i.e. it doesn’t include the base/media/full dependencies). E.g. any headers required for
compilation, and all dependencies required to run the tests and creating the docs.

tuio: The dependencies required to make TUIO work (primarily oscpy).

The following selectors install backends packaged as wheels by kivy under the Kivy_deps namespace.
They are typically released and versioned to match specific Kivy versions, so we provide selectors
to facilitate installation (i.e. instead of having to do pip install kivy kivy_deps.sdl2==x.y.z,
you can now do pip install "kivy[sdl2]" to automatically install the correct sdl2 for the Kivy
version).

gstreamer: The gstreamer video/audio backend, if it’s available

(currently only on Windows)

angle: A alternate OpenGL backend, if it’s available

(currently only on Windows)

sdl2: The window/image/audio backend, if it’s available (currently only on Windows,

on macOS, Linux and *BSD Unix is already included in the main Kivy wheel).

glew: A alternate OpenGL backend, if it’s available (currently only on Windows)

Following are the kivy_deps dependency wheels:

  • gstreamer (optional)

    kivy_deps.gstreamer is an optional dependency which is only needed for audio/video support.
    We only provide it on Windows, for other platforms it must be installed independently.
    Alternatively, use ffpyplayer instead.

  • glew and/or
    angle

    kivy_deps.glew and kivy_deps.angle are for OpenGL.
    You can install both, that is no problem. It is only available on Windows. On other
    platforms it is not required externally.

    One can select which of these to use for OpenGL using the
    KIVY_GL_BACKEND environment variable: By setting it to glew
    (the default), angle_sdl2, or sdl2. Here, angle_sdl2 is a substitute for
    glew but requires kivy_deps.sdl2 be installed as well.

  • sdl2

    kivy_deps.sdl2 is for window/images/audio and optionally OpenGL. It is only available on Windows
    and is included in the main Kivy wheel for other platforms.

Python glossary¶

Here we explain how to install Python packages, how to use the command line and what wheels are.

Installing Python¶

Kivy is written in
Python
and as such, to use Kivy, you need an existing
installation of Python.
Multiple versions of Python can be installed side by side, but Kivy needs to
be installed as package under each Python version that you want to use Kivy in.

To install Python, see the instructions for each platform:
Windows, macOS,
Linux, RPi,
*BSD.

Once Python is installed, open the console and make sure
Python is available by typing python --version.

How to use the command line¶

To execute any of the pip or wheel commands given here, you need a command line (here also called console, terminal, shell or bash, where the last two refer to Linux / *BSD Unix style command lines) and Python must be on the PATH.

The default command line on Windows is the
command prompt, short cmd. The
quickest way to open it is to press Win+R on your keyboard.
In the window that opens, type cmd and then press enter.

Alternative Linux style command lines on Windows that we recommend are
Git for Windows or Mysys.

Note, the default Windows command line can still be used, even if a bash terminal is installed.

To temporarily add your Python installation to the PATH, simply open your command line and then use the cd command to change the current directory to where python is installed, e.g. cd C:\Python37.

If you have installed Python using the default options, then the path to Python will already be permanently on your PATH variable. There is an option in the installer which lets you do that, and it is enabled by default.

If however Python is not on your PATH, follow the these instructions to add it:

  • Instructions for the windows command line

  • Instructions for bash command lines

What is pip and what are wheels¶

In Python, packages such as Kivy can be installed with the python package
manager, named pip (“python install package”).

When installing from source, some packages, such as Kivy, require additional steps, like compilation.

Contrary, wheels (files with a .whl extension) are pre-built
distributions of a package that has already been compiled.
These wheels do not require additional steps when installing them.

When a wheel is available on pypi.org (“Python Package Index”) it can be installed with pip. For example when you execute python -m pip install kivy in a command line, this will automatically find the appropriate wheel on PyPI.

When downloading and installing a wheel directly, use the command
python -m pip install <wheel_file_name>, for example:

python -m pip install C:\Kivy-1.9.1.dev-cp27-none-win_amd64.whl

What are nightly wheels¶

Every day we create a snapshot wheel of the current development version of Kivy (‘nightly wheel’).
You can find the development version in the master branch of the
Kivy Github repository.

As opposed to the last stable release (which we discussed in the previous section), nightly
wheels contain all the latest changes to Kivy, including experimental fixes.
For installation instructions, see Pre-release, pre-compiled wheels.

Warning

Using the latest development version can be risky and you might encounter
issues during development. If you encounter any bugs, please report them.

Table Of Contents

  • Installation on Windows
    • Installation components
      • Installing Python
      • Source installation Dependencies
    • Making Python available anywhere
      • Double-click method
      • Send-to method

To install Kivy on Windows via pip, please follow the main installation guide.

Installation components¶

Following, are additional information linked to from some of the steps in the
main installation guide, specific to Windows.

Installing Python¶

To install Python on Windows, download it from the main
Python website and follow the
installation steps. You can read about the individual installation options in the
Python guide.

If you installed the
Python launcher,
you will be more easily able to install multiple Python versions side by side
and select, which to run, at each invocation.

Source installation Dependencies¶

To install Kivy from source, please follow the installation guide until you reach the
Kivy install step and then install the compiler below before continuing.

To install kivy from source, you need a compiler. On Windows, the Visual Studio Build Tools are
required, and they are available for free. You can either:

  • Download and install the complete Visual Studio IDE, which contains the build tools.
    This is the easiest approach and the IDE can be downloaded from here.

  • The IDE is very big, so you can also download just the smaller build tools, which are used from the command line.
    The current download (2019) can be found on this page
    under “Tools for Visual Studio 2019”. More info about this topic can be found
    in the Kivy wiki.

Now that the compiler is installed, continue to install Kivy.

Making Python available anywhere¶

There are two methods for launching Python when double clicking on your *.py files.

Double-click method¶

If you only have one Python installed, and if you installed it using the default options, then *.py files are already
associated with your Python. You can run them by double clicking them in the file manager, or by just executing their name in a console window (without having to prepend python).

Alternatively, if they are not assigned, you can do it the following way:

  1. Right click on the Python file (.py file extension) in the file manager.

  2. From the context menu that appears, select Open With

  3. Browse your hard disk drive and find the python.exe file that you want
    to use (e.g. in the the virtual environment). Select it.

  4. Select “Always open the file with…” if you don’t want to repeat this
    procedure every time you double click a .py file.

  5. You are done. Open the file.

Send-to method¶

You can launch a .py file with Python using the Send to menu:

  1. Browse to the python.exe you want to use. Right click on it and
    copy it.

  2. Open Windows Explorer (the file explorer in Windows 8), and to go the address
    ‘shell:sendto’. You should get the special Windows directory SendTo.

  3. Paste the previously copied python.exe file as a shortcut.

  4. Rename it to python <python-version>. E.g. python39.

You can now execute your application by right clicking on the .py file ->
“Send To” -> “python <python-version>”.

Beginning with 1.9.1 we provide binary
wheels
for Kivy and all its dependencies to be used with an existing Python
installation. See Installation.

We also provide nightly wheels generated using Kivy
master. See Nightly wheel installation.
See also Upgrading from a previous Kivy dist. If installing kivy to an alternate
location
and not to site-packages, please see Installing Kivy to an alternate location.

Note

For Python < 3.5 we use the MinGW compiler. However, for Python 3.5+ on
Windows we currently only support the MSVC compiler
because of the following Python
issue 4709 about MinGW.
Generally this should make no difference when using precompiled wheels.

To use Kivy you need Python.
Multiple versions of Python can be installed side by side, but Kivy needs to
be installed for each Python version that you want to use Kivy.

Installation¶

Now that python is installed, open the Command line and make sure
python is available by typing python --version. Then, do the following to
install.

  1. Ensure you have the latest pip and wheel:

    python -m pip install --upgrade pip wheel setuptools
    
  2. Install the dependencies (skip gstreamer (~120MB) if not needed, see
    Kivy’s dependencies):

    python -m pip install docutils pygments pypiwin32 kivy.deps.sdl2 kivy.deps.glew
    python -m pip install kivy.deps.gstreamer
    

    For Python 3.5 only we additionally offer angle which can be used instead of glew
    and can be installed with:

    python -m pip install kivy.deps.angle
    
  3. Install kivy:

    python -m pip install kivy
    
  4. (Optionally) Install the kivy examples:

    python -m pip install kivy_examples
    

    The examples are installed in the share directory under the root directory where python is installed.

That’s it. You should now be able to import kivy in python or run a basic
example if you installed the kivy examples:

python share\kivy-examples\demo\showcase\main.py

What are wheels, pip and wheel¶

In Python, packages such as Kivy can be installed with the python package
manager, pip. Some packages such as Kivy
require additional steps, such as compilation, when installing using the Kivy
source code with pip. Wheels (with a .whl extension) are pre-built
distributions of a package that has already been compiled and do not require
additional steps to install.

When hosted on pypi one installs a wheel
using pip, e.g. python -m pip install kivy. When downloading and
installing a wheel directly, python -m pip install wheel_file_name is used,
such as:

python -m pip install C:\Kivy-1.9.1.dev-cp27-none-win_amd64.whl

Nightly wheel installation¶

Warning

Using the latest development version can be risky and you might encounter
issues during development. If you encounter any bugs, please report them.

Snapshot wheels of current Kivy master are created on every commit to the
master branch of kivy repository. They can be found
here. To use them, instead of
doing python -m pip install kivy we’ll install one of these wheels as
follows.

  • Python 2.7, 32bit
  • Python 3.4, 32bit
  • Python 3.5, 32bit
  • Python 3.6, 32bit
  • Python 2.7, 64bit
  • Python 3.4, 64bit
  • Python 3.5, 64bit
  • Python 3.6, 64bit
  1. Perform steps 1 and 2 of the above Installation section.
  2. Download the appropriate wheel for your system.
  3. Install it with python -m pip install wheel-name where wheel-name
    is the name of the renamed file and add deps to the PATH.

Kivy examples are separated from the core because of their size. The examples
can be installed separately on both Python 2 and 3 with this single wheel:

  • Kivy examples

Kivy’s dependencies¶

We offer wheels for Kivy and its dependencies separately so only desired
dependencies need be installed. The dependencies are offered as
optional sub-packages of kivy.deps, e.g. kivy.deps.sdl2.

Currently on Windows, we provide the following dependency wheels:

  • gstreamer for audio and video
  • glew and/or
    angle (3.5 only) for OpenGL
  • sdl2 for control and/or OpenGL.

One can select which of these to use for OpenGL use using the
KIVY_GL_BACKEND envrionment variable by setting it to glew
(the default), angle, or sdl2. angle is currently
in an experimental phase as a substitute for glew on Python
3.5 only.

gstreamer is an optional dependency which only needs to be
installed if video display or audio is desired. ffpyplayer
is an alternate dependency for audio or video.

Command line¶

Know your command line. To execute any of the pip
or wheel commands, one needs a command line tool with python on the path.
The default command line on Windows is
Command Prompt, and the
quickest way to open it is to press Win+R on your keyboard, type cmd
in the window that opens, and then press enter.

Alternate linux style command shells that we recommend is
Git for Windows which offers a bash
command line as well as
git. Note, CMD can still be used even if bash is
installed.

Walking the path! To add your python to the path, simply open your command line
and then use the cd command to change the current directory to where python
is installed, e.g. cd C:\Python27. Alternatively if you only have one
python version installed, permanently add the python directory to the path for
cmd or
bash.

Use development Kivy¶

Warning

Using the latest development version can be risky and you might encounter
issues during development. If you encounter any bugs, please report them.

To compile and install kivy using the kivy
source code or to use
kivy with git rather than a wheel there are some additional steps:

  1. Both the python and the Python\Scripts directories must be on
    the path. They must be on the path every time you recompile kivy.

  2. Ensure you have the latest pip and wheel with:

    python -m pip install --upgrade pip wheel setuptools
    
  3. Get the compiler.
    For Python < 3.5 we use mingwpy as follows.

    1. Create the
      python\Lib\distutils\distutils.cfg file and add the two lines:

      [build]
      compiler = mingw32
      
    2. Install MinGW with:

      python -m pip install -i https://pypi.anaconda.org/carlkl/simple mingwpy
      

    For Python 3.5 we use the MSVC compiler. For 3.5,
    Visual Studio 2015 is
    required, which is availible for free. Just download and install it and
    you’ll be good to go.

    Visual Studio is very big so you can also use the smaller,
    Visual C Build Tools instead.

  4. Set the environment variables. On windows do:

    set USE_SDL2=1
    set USE_GSTREAMER=1
    

    In bash do:

    export USE_SDL2=1
    export USE_GSTREAMER=1
    

    These variables must be set everytime you recompile kivy.

  5. Install the other dependencies as well as their dev versions (you can skip
    gstreamer and gstreamer_dev if you aren’t going to use video/audio):

    python -m pip install cython docutils pygments pypiwin32 kivy.deps.sdl2 \
    kivy.deps.glew kivy.deps.gstreamer kivy.deps.glew_dev kivy.deps.sdl2_dev \
    kivy.deps.gstreamer_dev
    
  6. If you downloaded or cloned kivy to an alternate location and don’t want to
    install it to site-packages read the next section.

  7. Finally compile and install kivy with pip install filename, where
    filename can be a url such as
    https://github.com/kivy/kivy/archive/master.zip for kivy master, or the
    full path to a local copy of a kivy.

Compile Kivy¶

  1. Start installation of Kivy cloned from GitHub:

    python -m pip install kivy\.
    

If the compilation succeeds without any error, Kivy should be good to go. You
can test it with running a basic example:

python share\kivy-examples\demo\showcase\main.py

Installing Kivy to an alternate location¶

In development Kivy is often installed to an alternate location and then
installed with:

python -m pip install -e location

That allows Kivy to remain in its original location while being available
to python, which is useful for tracking changes you make in Kivy for example
directly with Git.

To achieve using Kivy in an alternate location extra tweaking is required.
Due to this issue wheel and
pip install the dependency wheels to python\Lib\site-packages\kivy. So
they need to be moved to your actual kivy installation from site-packages.

After installing the kivy dependencies and downloading or cloning kivy to your
favorite location, do the following:

  1. Move the contents of python\Lib\site-packages\kivy\deps to
    your-path\kivy\deps where your-path is the path where your kivy is
    located.
  2. Remove the python\Lib\site-packages\kivy directory altogether.
  3. From python\Lib\site-packages move all kivy.deps.*.dist-info
    directories to your-path right next to kivy.

Now you can safely compile kivy in its current location with one of these
commands:

> make
> mingw32-make
> python -m pip install -e .
> python setup.py build_ext --inplace

If kivy fails to be imported, you probably didn’t delete all the
*.dist-info folders and and the kivy or kivy.deps* folders from
site-packages.

Making Python available anywhere¶

There are two methods for launching python on your *.py files.

Double-click method¶

If you only have one Python installed, you can associate all *.py files
with your python, if it isn’t already, and then run it by double clicking. Or
you can only do it once if you want to be able to choose each time:

  1. Right click on the Python file (.py file extension) of the application you
    want to launch
  2. From the context menu that appears, select Open With
  3. Browse your hard disk drive and find the file python.exe that you want
    to use. Select it.
  4. Select “Always open the file with…” if you don’t want to repeat this
    procedure every time you double click a .py file.
  5. You are done. Open the file.

Send-to method¶

You can launch a .py file with our Python using the Send-to menu:

  1. Browse to the python.exe file you want to use. Right click on it and
    copy it.
  2. Open Windows explorer (File explorer in Windows 8), and to go the address
    ‘shell:sendto’. You should get the special Windows directory SendTo
  3. Paste the previously copied python.exe file as a shortcut.
  4. Rename it to python <python-version>. E.g. python27-x64

You can now execute your application by right clicking on the .py file ->
“Send To” -> “python <python-version>”.

Upgrading from a previous Kivy dist¶

To install the new wheels to a previous Kivy distribution all the files and
folders, except for the python folder should be deleted from the distribution.
This python folder will then be treated as a normal system installed python and
all the steps described in Installation can then be continued.

Search code, repositories, users, issues, pull requests…

Provide feedback

Saved searches

Use saved searches to filter your results more quickly

Sign up

Example

Windows

There are two options how to install Kivy:

First ensure python tools are up-to-date.

python -m pip install --upgrade pip wheel setuptools

Then install the basic dependencies.

python -m pip install docutils pygments pypiwin32 kivy.deps.sdl2 kivy.deps.glew

Although Kivy already has providers for audio & video, GStreamer is required for more advanced stuff.

python -m pip install kivy.deps.gstreamer --extra-index-url https://kivy.org/downloads/packages/simple/

To make it simpler, <python> in the following text means a path to the directory with python.exe file.

  1. Wheel

    The wheel package provides compiled Kivy, but with removed cython source components, which means the core code can’t be recompiled using this way. Python code, however, is editable.

    The stable version of Kivy is available on pypi.

    python -m pip install kivy
    

    The latest version from the official repository is available through nightly-built wheels available on google drive. Visit the link in docs matching your python version. After a proper wheel is downloaded, rename it to match the formatting of this example and run the command.

    python -m pip install C:\Kivy-1.9.1.dev-cp27-none-win_amd64.whl
    
  2. Source

    There are more required dependencies needed to install Kivy from source than using the wheels, but the installation is more flexible.

    Create a new file in <python>\Lib\distutils\distutils.cfg with these lines to ensure a proper compiler will be used for the source code.

    [build]
    compiler = mingw32
    

    Then the compiler is needed. Either use some you already have installed, or download mingwpy. The important files such as gcc.exe will be located in <python>\Scripts.

    python -m pip install -i https://pypi.anaconda.org/carlkl/simple mingwpy
    

    Don’t forget to set environment variables to let Kivy know what providers it should use.

    set USE_SDL2=1
    set USE_GSTREAMER=1
    

    Now install the additional dependencies required for the compilation.

    python -m pip install cython kivy.deps.glew_dev kivy.deps.sdl2_dev
    python -m pip install kivy.deps.gstreamer_dev --extra-index-url https://kivy.org/downloads/packages/simple/
    

    Check Paths section to ensure everything is set properly and install Kivy. Choose one of these options:

    python -m pip install C:\master.zip
    python -m pip install https://github.com/kivy/kivy/archive/master.zip
    

Paths

Kivy needs an access to the binaries from some dependencies. This means the correct folders have to be on the environment’s PATH variable.

set PATH=<python>\Tools;<python>\Scripts;<python>\share\sdl2\bin;%PATH%

This way Python IDLE IDE can be included to the path with <python>\Lib\idlelib;. Then write idle into console and IDLE will be ready to use Kivy.

Simplify it

To avoid repetitive setting of environment variables either set each necessary path this way or make a batch(.bat) file with these lines placed into <python>:

set PATH=%~dp0;%~dp0Tools;%~dp0Scripts;%~dp0share\sdl2\bin;%~dp0Lib\idlelib;%PATH%
cmd.exe

To run Kivy project after installation run cmd.exe or the batch file and use python <filename>.py

installation on Ubuntu

For install kivy on ubuntu with kivy example open terminal and run following command

First add ppa

 sudo add-apt-repository ppa:kivy-team/kivy

For install kivy

 sudo apt-get install python-kivy

For install kivy examples

 sudo apt-get install python-kivy-example

  • Как установить kerio control на windows
  • Как установить kali linux рядом с windows 11
  • Как установить kb4474419 для windows 7
  • Как установить kb2670838 для windows 10
  • Как установить kaspersky internet security на windows 7