Установка python pycharm kivy

How to configure Python Kivy for PyCharm on Windows?

This Kivy’s Wiki page Setting Up Kivy with various popular IDE’s has a better answer and detail commands. It is copied below with added information for Pycharm 3.4.

Go to your unzipped Kivy folder, create a symbol link for «kivy.bat» pointing to «python.bat» in the same directory (mklink python.bat kivy.bat).

Add 2 new Python interpreters in PyCharm.

  • Bootstrapper: Choose the earlier created «python.bat» from the Kivy package folder.
  • Project Interpreter: Choose the «python.exe» from the Python subdirectory in the Kivy package folder.

For the project interpreter, add a path to the «kivy» directory directly contained in the Kivy package folder. In PyCharm 3.4, the path tab is hidden in a sub menu. In Project Interpreter, click the tool icon next to the interpreter dropdown list, click more. (the last one), in the list of all project interpreters, select Run-Configuration Interpreter, on the right side there are five icons (+, -, edit, virtual env, and path), click path to add the Kivy sub-directory in unzipped Kivy folder.

Save all settings and ignore warnings about «Invalid output format». Make sure that the project interpreter is set to our earlier created configuration.

Create a new run configuration and set the Python interpreter to our earlier created bootstrapper.

Simply run the configuration to execute your Kivy application

settings image

  1. If you already had it installed and have a project open, click File -> Settings (Ctrl + Alt + S) . (If not, create a new project, and click the ‘ . ‘ (or ) next to interpreter, and skip step 2)
  2. Under Project Settings, click Project Interpreter -> Python Interpreters
  3. Click the little green + and select local (You can also set up an interpreter to your installed python from this list)
  4. Point it to ..\Kivy\Python\python.exe and click ok (my path was c:\Program files (x86)\Kivy\Python\python.exe since that is where I unzipped the kivy zip file to)

I have also attached a settings.jar file. This is the kv language definition. It is not complete, but it helps a lot. Click File->Import and select the settings.jar file. Only FileTypes will be ticked. Import this and you will have » kv language file » definition under File->Settings-IDE Settings->File Types

Open a kv file to see the differentiation in colours, as well as autocomplete

  • Widgets are type 1
  • Properties are type 2
  • all events (on_something) are type 3
  • type 4 is just self and root.

That is all for PyCharm, the rest is Windows 7 specific

  1. open a command prompt and browse to your ..\Kivy\Python\lib folder
  2. type mklink /D kivy «..\Kivy\kivy\kivy» (my line was mklink /D kivy «c:\Program files (x86)\Kivy\kivy\kivy» ) This will set up a symlink so that your all your kivy python files are read and their definitions are included, in order to get autocomplete
Читайте также:  Css for image source

Now we need to set up the environment variables. You could do this per project inside PyCharm, but might as well do it in windows, so you only need to select the python interpreter each time.

Click start and type envir Select the second one. (System variables) (You could also get here with Win+PauseBreak -> Click Advanced system settings ) Click Environment variables

Now add these (once again, just point to wherever you have your kivy folder. You can also find all these in the kivy.bat file, just find and replace the variables with your path)

GST_PLUGIN_PATH c:\Program Files (x86)\Kivy\gstreamer\lib\gstreamer-0.10 GST_REGISTRY c:\Program Files (x86)\Kivy\gstreamer\registry.bin PATH c:\Program Files (x86)\Kivy;c:\Program Files (x86)\Kivy\Python;c:\Program Files (x86)\Kivy\gstreamer\bin;c:\Program Files (x86)\Kivy\MinGW\bin;c:\Program Files (x86)\Kivy\kivy;%PATH 

Restart your machine. (For the environment variables to load)

Now when you open your kivy project, just select the Kivy interpreter you set up earlier, and bobs your uncle.

Источник

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

Установка Python Kivy и используйте Pycharm для простого тестирования (объясните, как обратиться к официальному тесту Kivy’s Office Installation)

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

До этого Python3.8 и Pycharm были установлены на моем компьютере.

Здесь я напрямую открываю страницу Руководства по установке Windows на официальном сайте.

Поскольку я не использовал Anaconda, я продолжал находить установку стабильного выпуска Kivy (стабильная версия, выпущенная Kivy)

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

Сначала убедитесь, что у вас есть последнее колесо PIP и VirtualENV, и запустите командную строку (CMD) в качестве администратора (CMD)

python -m pip install --upgrade pip wheel setuptools virtualenv

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

Этот шаг — создать виртуальную среду, потому что я

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:

Зависимости установки, если GSTREAMER не требуется, если вы обновляете Kivy, появитесь и обратитесь к немуUpdating Kivy from a previous release:

Здесь я могу использовать GSTREAMER, и это недавно установленная Kivy, поэтому введите следующие команды в очередь в соответствии с инструкциями:

python -m pip install docutils pygments pypiwin32 kivy_deps.sdl2==0.1.* kivy_deps.glew==0.1.* python -m pip install kivy_deps.gstreamer==0.1.*

Следующий шаг для Python 3.5+, вы также можете использовать угловые спинки GLEW. Это можно установить с:

Другими словами, версия Python 3.5 может использовать угол для замены GLEW. Хотя я использую Python 3.8 и устанавливаю GLEW, я все еще могу установить угол.

Читайте также:  Runtimewarning invalid value encountered in sqrt python

Используйте следующую команду для установки угла

python -m pip install kivy_deps.angle==0.1.*

Следующий шаг установите Kivy:

Установите Kivy, введите следующую установку команды

python -m pip install kivy==1.11.1

Затем сделайте ошибку, ошибки запроса следующим образом: Команда ошибочна со статусом выхода 1:

ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

Затем проверьте его в Интернете, а затем проверьте его на GitHub, что кто -то столкнулся с этой ошибкой, а затем кто -то решил ее.

Затем попробуйте ввести следующую команду, он сказал: давайте попробуем еще раз,

pip3 install --pre --extra-index-url https://kivy.org/downloads/simple kivy[base]

На данный момент установите успех Kivy

Следующий шаг (необязательно) Установите примеры Kivy:

Установите пример (необязательно). После установки вы должны взять пример программы для ее проверки, и вы можете обратиться к нему в будущем, поэтому пример будет установлен

python -m pip install kivy_examples==1.11.1

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

Пример устанавливается в папке «Общаясь» под пути, который вы установили Python. Мой Python установлен в C: \ Program Files \ Python38

Следовательно, из папки Share под Python38 вы можете найти пример папки Kivy-Examples

Далее это. Теперь вы должны иметь возможность import kivy in python or run a basic example if you installed the kivy examples:

Вы можете запустить пример:

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

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

Если вы не используете VirtualEnv для установки Kivy_venv с помощью пути установки Python, мой Python установлен в C: \ Program Files \ Python38, поэтому вам следует ввести следующие команды.

python C:\Program Files\Python38\share\kivy-examples\demo\showcase\main.py

Как только он не станет неправильно

Поскольку Python не разрешается использовать пространство, рекомендуется, чтобы путь C: \ Program не может быть найден, но я не могу изменить файлы программы, поэтому копируйте перерывы Kivy непосредственно в корневой каталог диска C.

Затем введите пример выполнения следующей команды

python C:\kivy-examples\demo\showcase\main.py

Образец программы успешно работает

Используйте Pycharm, чтобы написать Hello World, чтобы попробовать

Создайте новый проект, поскольку VirtualENV не используется, выберите существующий интерпретатор и выберите установлен Python Interpreter. Mine установлен на C: \ Program Files \ Python38

Создайте новый файл hello_world .py в рамках проекта

import kivy kivy.require('1.0.6') # replace with your current kivy version ! from kivy.app import App from kivy.uix.label import Label class MyApp(App): def build(self): return Label(text='Hello world') if __name__ == '__main__': MyApp().run() 

Привет, мир успешно работает

Оригинальные работы, если вам нужно перепечатать, укажите источник!

Источник

Saved searches

Use saved searches to filter your results more quickly

You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session.

Читайте также:  What is timezone in java

Home

Clone this wiki locally

Installation, Documentation and Examples

Extensive installation instructions as well as tutorials and general documentation, including an API reference, can be found at https://kivy.org/docs. A PDF version is also available.

Kivy ships with many examples which can be found in the examples folder.

  • The Kivy Website: For the official documentation, latest downloads and user guides.
  • Talks and Tutorials: Introductory videos and learning material.
  • Setting up Kivy with various popular IDE’s: Setting up your Kivy development environment
  • Kivy Docs: The official documentation
  • Snippets: Collection of useful code snippets for common tasks.
  • Kivy Blogs and Blog Posts: Blog posts about Kivy by Kivy users from around the world
  • Profiling your Kivy application: Learn to optimize and tweak your Kivy app
  • The Kivy Garden: A collection of Kivy widgets from the community
  • Kivy projects: All Kivy related projects
  • KivEnt: an Entity Based Game Engine for Kivy by Kovak
  • Tiled Maps & Tile Based Movement: Get up and running with a simple Tiled map.
  • Plyer: a platform-independent api to use features commonly found on various platforms, notably mobile ones
  • Pyjnius: a Python module to access Java class as Python class, using JNI.
  • Python for Android: Access Android specific functionality
  • Pyobjus: a Python module to access Objective-C class as Python class, using Objective-C runtime reflection
  • Google Analytics and Monitoring: Kivy recipe for Google analytics, play services and bug reporting.
  • Google Play Recipes: An example of a Google Play Services client.

At Kivy, we love code and coders so we want to help you. Feel free to ask questions, make comments or join us for a chat. All we ask is that you be nice and follow our Community Guidelines.

  • The Kivy Users Forum: Questions and answers for everyone
  • The Kivy Developers Forum: For devs wanting to discuss the Kivy framework development
  • IRC: Join us at #Kivy on irc.freenode.net (IRC Guidelines)
  • The Kivy Contact Us Page links to more venues, including an official Discord chat
  • List of Kivy Projects: Projects that were created using Kivy
  • Theming Kivy — Various approaches and guides to theming your Kivy app.
  • Kivy Artwork — A small collection of Kivy Logo’s and wallpapers.
  • Kivy Technical FAQ — A place to document Kivy tips, tricks, hacks, etc., in FAQ format.
  • Kv language preprocessing: Enhancing kvlang via pyexpander.

This section contains internal notes for the Kivy devs.

Hardware Compatibility List and known issues

This section lists hardware with known issues with kivy.

The information here is not exhaustive but provides a brief overview of the Kivy landscape. If you know of any other good resources that should be added, please let us know! Oh, and enjoy Kivy!

Источник

Оцените статью