Как установить kivy python на windows
Перейти к содержимому

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

  • автор:

Unofficial Windows Binaries for Python Extension Packages

When updating from a previous Kivy release, all the Kivy dependencies must be updated first. Typically, just adding –upgrade to the pip install … commands below is sufficient for pip to update them.

When updating from Kivy 1.10.1 or lower to 1.11.0 or higher, one must manually uninstall all kivy dependencies before upgrading because won’t update them properly. This is done with:

assuming all the dependencies were previously installed. See Kivy’s dependencies for more details.

After uninstalling, continue with the installation below.

Installing the kivy stable release

Kivy 1.11.1 is the last release that supports Python 2.

Now that python is installed, open the Command line and make sure python is available by typing python —version . Then, do the following to create a new virtual environment (optionally) and install the most recent stable kivy release ( 1.11.1 ) and its dependencies.

Ensure you have the latest pip, wheel, and virtualenv:

Optionally create a new virtual environment for your Kivy project. Highly recommended:

First create the environment named kivy_venv in your current directory:

Activate the virtual environment. You’ll have to do this step from the current directory every time you start a new terminal. On windows CMD do:

If you’re in a bash terminal, instead do:

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.

Install the dependencies (skip gstreamer (

120MB) if not needed, see Kivy’s dependencies). If you are upgrading Kivy, see Updating Kivy from a previous release:

If you encounter a MemoryError while installing, add after pip install the –no-cache-dir option.

For Python 3.5+, you can also use the angle backend instead of glew. This can be installed with:

When installing, pin kivy’s dependencies to the specific version that was released on pypi when your kivy version was released, like above. Otherwise you may get an incompatible dependency when it is updated in the future.

(Optionally) Install the 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:

Replace kivy_venv with the path where python is installed if you didn’t use a virtualenv.

If you encounter any permission denied errors, try opening the Command prompt as administrator and trying again. The best solution for this is to use a virtual environment instead.

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:

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 .

In Kivy 1.11.0 we transitioned the kivy Windows dependencies from the kivy.deps.xxx namespace stored under kivy/deps/xxx to the kivy_deps.xxx namespace stored under kivy_deps/xxx . Pip is sometimes not able to distinguish between these two formats, so follow the instructions at Updating Kivy from a previous release when upgrading from a older Kivy. See here for more details.

Currently on Windows, we provide the following dependency wheels:

    for audio and video and/or angle (3.5 only) for OpenGL for control and/or OpenGL.

One can select which of these to use for OpenGL 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.

Installation on Windows¶

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 .

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.

Ensure you have the latest pip and wheel:

Install the dependencies (skip gstreamer (

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

(Optionally) Install the 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:

If you encounter any permission denied errors, try opening the Command prompt as administrator and trying again.

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:

Nightly wheel installation¶

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.

  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’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:

    for audio and video and/or angle (3.5 only) for OpenGL 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¶

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:

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

Ensure you have the latest pip and wheel with:

Get the compiler. For Python < 3.5 we use mingwpy as follows.

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

Install MinGW with:

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.

Set the environment variables. On windows do:

These variables must be set everytime you recompile kivy.

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):

If you downloaded or cloned kivy to an alternate location and don’t want to install it to site-packages read the next section.

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¶

Start installation of Kivy cloned from GitHub:

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

Installing Kivy to an alternate location¶

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

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:

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.

How to install kivy on Windows 10

I have tried following the steps on the website but they’re not working for me. At least I must be doing something for them not to work.

Firstly, before the steps, the site tells me to open the command line and type python —version . So I typed on the windows search bar ‘command line’. Python (command line) came up and I went ahead and typed python —version and I got the error

along with other stuff. So I decided to try the command prompt, the second option to come up when I typed ‘command line’ in on my windows search. It returned saying that it was not recognized as an internal or external file.

I attempted step 1, just to try my luck, on both the Python command line and the command prompt and nothing really happened. I’m not really sure what to do now.

Peter Badida's user avatar

5 Answers 5

Try KivyInstaller, it’ll do everything for you 🙂

command line is cmd.exe which you can call with shortcut Win+R and typing cmd or shift +rightclick in your python installation for example and there you’ll see something with «prompt»

Kivy is a framework for python, that means you need Python, which you probably didn’t have and when you typed python —version to. most probably cmd.exe , because «python is not defined»

Peter Badida's user avatar

Solution to the installation problem is that kivy doesn’t compatible to python 3.8.X. So you need python 2.7.X to 3.7.X to run kivy. And then all the general installation process like for windows, type the followings serially in the command prompt :

And everything will work just fine. Happy Coding

i have encountered a simillar setback while trying to install kivy on python. in python version 3, py is used instead of python for launching python in the command prompt i.e py (to launch python3) py -m pip install kivy (to install kivy)

N.b: before installing kivy it is recommended to install cython and other python dependencies using py -m pip install cython

MD Jalals method works perfectly for me. Now kivy runs in SublimeText 3 with a 32 bit python 3.8.3! There are a lot of messages in the terminal window when running. I created a new project with sublime and saved the file main.py, listed below (from tech with Tim on YouTube, https://www.youtube.com/watch?v=bMHK6NDVlCM

After installing like MD Jalal says, and changing python interpreter in pycharm/jetbrains to python 3.8.3 32 bit, everything works there too. Anaconda’s python 3.8, 3.7 does not work, python 3.8.3 64 bit also does not work.

Tim’s simple window with label:

Thanks to MD Jalal and Tim on the Tube!

To king charles’ remark: It is true that if You have both the 64 bit and the 32 bit python installed, py is the 64 bit and python is the 32 bit, at least if You install the 64 bit version first. I have not tried to install with py -m pip install for MD Jalal’s description, just python -m pip install. And when using the 32 bit interpreter for python, kivy works in SublimeText as well as in PyCharm.

Русские Блоги

Пример установки kivy и kivy с pip в python3 под windows

Живой URL: На этом сайте есть подробный процесс установки, я просто носильщик.

Библиотека Python Kivy-Open source для быстрой разработки приложений, использующая инновационные пользовательские интерфейсы, такие как приложения мультитач.

Моя версия на Python:

Шаги по установке кивы:

1. Убедитесь, что у вас установлена ​​последняя версия pip и wheel

2. Установочные зависимости

Если вы столкнулись с ошибкой памяти, добавьте

Если установленная версия Python больше 3.5, вместо glew вы можете использовать следующее:

3. Установить кивы

4. Установите кивый пример:

Примеры моей установки:

Поэтому я запускаю программу main.py следующим образом;

Появится следующее окно (это пример):

В процессе установки я могу ошибаться на определенном этапе, но я просто повторяю это снова и снова, просто отлично.

Ниже приведен небольшой пример игры, который поставляется с kivy. Исходя из приведенного выше пути установки, исходный код модифицированной программы:

Создайте main.py и pong.kv в одной папке, их содержимое выглядит следующим образом:

——————— Эта статья взята из блога Koma_Wong’s CSDN. Для получения полного текстового адреса, пожалуйста, нажмите: https://blog.csdn.net/Rong_Toa/article/details/79810423 ? utm_source = copy

Интеллектуальная рекомендация

cf 1092d2 мышление + стек

Заглавие: n столбцов из вертикально расположенных кирпичей, высота каждого столбца ai, существует бесчисленное множество кирпичей 2 * 1, которые можно разместить горизонтально только на двух соседних .

Команда Python Daemon, почему это взломано? Целые трояны используют это!

Почему команда Python Daemon должна быть взломана? Весь троян используется. Yingqi. Python полный стек инженер Подумайте об использовании Python, чтобы сделать целое, троянское программное обеспечение.

Когда Mac Brew, я застрял в решении Brew Update

Не говоря уже о том, что варево переключается на источник или что -то в этом роде, он слишком бросает. Правильный метод состоит в том, что когда обновляющий варево . Control+C возвращается, чтобы ос.

Использование регулярных выражений BeautifulSoup в Python Crawler

В BeautifulSoup вы можете найти имя и атрибут по имени и атрибутам, чтобы найти конкретный html-код. Что еще похвально, attrs поддерживает регулярные выражения. Такие как: Для поиска этой строки вы мо.

Добавить комментарий

Ваш адрес email не будет опубликован. Обязательные поля помечены *