Как установить kivy на Windows?
Устанавливаю через консоль cython ( pip install cython) — цитон установился нормально,затем устанавливаю kivy ( pip install cython).
В самом конце установки выдаёт следующее:
Command «c:\users\алексей\appdata\local\programs\python\python35-32\python.exe —
c «import setuptools, tokenize;__file__=’C:\\Users\\CD86~1\\AppData\\Local\\Temp
\\pip-build-33egwhfv\\kivy\\setup.py’;exec(compile(getattr(tokenize, ‘open’, ope
n)(__file__).read().replace(‘\r\n’, ‘\n’), __file__, ‘exec’))» install —record
C:\Users\CD86~1\AppData\Local\Temp\pip-zpfjldxr-record\install-record.txt —sing
le-version-externally-managed —compile» failed with error code 1 in C:\Users\CD
86~1\AppData\Local\Temp\pip-build-33egwhfv\kivy
В чём может быть проблема?
Операционная система Windows 7
Python 3.5.1
- Вопрос задан более трёх лет назад
- 9850 просмотров
Не получается установить kivy. python
Перед тем как ввести python -m pip install kivy, ввёл вот это: python -m pip install —upgrade pip wheel setuptools virtualenv python -m pip install docutils pygments pypiwin32 kivy_deps.sdl2 kivy_deps.glew Всё обновилось и установилось кроме киви.
Отслеживать
задан 17 дек 2019 в 5:46
152 4 4 серебряных знака 15 15 бронзовых знаков
добро пожаловать на Stack Overflow на русском! текстовую информацию лучше прилагать в виде текста: а) читать легче; б) можно копировать; в) поиск работает. исправить текст вопроса можно, нажав править ниже текста вопроса
17 дек 2019 в 5:50
Явно проблема с зависимостями. Можно попробовать создать отдельное conda окружение и в нем с нуля все установить.
17 дек 2019 в 7:06
17 дек 2019 в 16:56
Xyanight, именно отсюда всё вписывал
18 дек 2019 в 14:46
Какая версия python?
19 дек 2019 в 4:48
2 ответа 2
Сортировка: Сброс на вариант по умолчанию
С 3.8 официальная 1.11.1 версия Kivy не работает.
Но, как пишут, можно установить из мастер ветки, где всё должно работать:
pip install kivy[base] kivy_examples --pre --extra-index-url https://kivy.org/downloads/simple/
Отслеживать
ответ дан 30 дек 2019 в 11:55
Suvitruf — Andrei Apanasik Suvitruf — Andrei Apanasik
32.2k 15 15 золотых знаков 61 61 серебряный знак 93 93 бронзовых знака
Я для установки Kivy использовал виртуальную машину с Linux cистемой.
-
Устанавливаем все зависимости с помощью шелл скрипта. Как написал Zvorian : В последнее время java 8 не устанавливается обычным способом. Устанавливайте здесь — https://pkgs.org/download/oracle-java8-installer у меня сработало. Потом : делаем действие под номером 2 (Решение взято отсюда) OS: Ubuntu 18.04 (Я делал это на Минте) Installing Java version 8 fixed this issue for me.
sudo apt-get install openjdk-8-jdk
Installing Kivy¶
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.







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:
-
Create the virtual environment named kivy_venv in your current directory:
python -m virtualenv kivy_venv
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
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:
./build_kivy_deps.sh
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¶
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:
make
To run the test suite, simply run:
pytest kivy/tests
or in bash or Linux:
make test
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.
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
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 , 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 .
Using the latest development version can be risky and you might encounter issues during development. If you encounter any bugs, please report them.
AlexKorablev.ru

Александр Кораблев о разработке ПО, ИТ-индустрии и Python.
Проект на Kivy. Часть 1. Настройка окружения
Опубликовано 16 May 2016 в Python
Kivy — интересный проект, который позволяет делать кроссплатформенные GUI приложения, включая мобильные. По слухам. Я решил выяснить можно ли использовать его для создания маленьких приложений на питоне. В этой серии статей я попробую поисследовать Kivy на примере клона «конструктора слов» — одного из упражнений для LingvoLeo.
Эта серия — не учебник, а исследовательский лог моих попыток. В результате я планирую получить собранные приложения для трех платформ минимум: Windows, Mac, Android. Будет здорово, если я соберу еще и iOS версию. В качестве основной платформы для разработки я использую Mac. Так что, все инструкции по установке и настройке окружения будут для этой операционной системы.
Установка
Под мак есть два способа поставить Kivy: скачать бандл или установить зависимости из homebrew, а kivy поставить с помощью pip.
Первый способ (быстрый):
- Скачать с http://kivy.org/#download Kivy2.7z (использует системный питон 2.7) или Kivy3.7z (включает в себя Python 3.5)
- Распаковываем архив
- Копируем в приложения
sudo mv Kivy3.app /Applications/Kivy.app
ln -s /Applications/Kivy.app/Contents/Resources/script /usr/local/bin/kivy
Минус этого способа установки в том, что создается только одно виртуальное окружение на все Kivy проекты. Для маленьких проектов такой способ подойдет, для больших — сомневаюсь. Так что лучше сразу ставить фремворк в свое окружение.
Второй способ (правильный):
Подразумеваю, что вы пользуетесь pyenv и pyenv-virtualenv.
Первым делом ставим зависимости.
brew install sdl2 sdl2_image sdl2_ttf sdl2_mixer gstreamer
Ставим свежий питончик.
pyenv install 3.5.1
Иногда установка падает:
zipimport.ZipImportError: can't decompress data; zlib not available
В этом случае поможет:
xcode-select --install
Как только свежий питон стоит, создаем виртуальное окружение для нашего проекта.
pyenv virtualenv 3.5.1 WordConstructor
Активируем созданное окружение
pyenv activate WordConstructor
pip install -I Cython==0.23
USE_OSX_FRAMEWORKS=0 pip install kivy
Проверим, что все работает. Создадим файлик main.py в папке с проектом с таким содержимым:
from kivy.app import App from kivy.uix.widget import Widget class WordConstructorGame(Widget): pass class WordConstructorApp(App): def build(self): return WordConstructorGame() if __name__ == '__main__': WordConstructorApp().run()
python main.py
Если открылось окно с заголовком WordConstructor, все установилось и работает как надо.
PyCharm
Теперь настроим проект в пайчарме.
В Preferences выбираем Project interpreter соответствующий нашему виртуальному окружению.

Для описания интерфейсов в Kivy используется свой язык Kv Design Language. Неплохо бы добавить для него подсветку синтаксиса и автокомплит.
- Для этого качаем https://github.com/Zen-CODE/kivybits/blob/master/IDE/PyCharm_kv_completion.jar?raw=true
- В PyCharm в меню File -> Import Settings импортируем этот файл.
- Удостоверившись, что стоит галочка File types, нажимаем OK.
- Перезагружаем PyCharm и наслаждаемся результатом.
С настройкой все. В следующей статье обсудим более практические вопросы.
—
Возник вопрос? Мне всегда можно написать в Twitter: avkorablev
Понравилась статья? Поделись с друзьями!
