Kivy, Eclipse and PyDev (also PyPy)

浪尽此生 提交于 2019-11-28 06:29:24

Using Kivy with Pydev on Windows xp/7

  • Under Window/Preferences/PyDev/Interpreter-Python add a new interpreter pointing to the python executable which ships with kivy portable
  • add kivy package folder under libraries tab (still in Python Interpreters Prefs section making sure the kivy python interpreter is selected)
  • In Environment tab, add the following three key-value pairs: (assumptions: kivy root is c:\kivy)

    GST_REGISTRY = c:\kivy\gstreamer\registry.bin

    GST_PLUGIN_PATH = c:\kivy\gstreamer\lib\gstreamer-0.10

    PATH = c:\kivy;c:\kivy\Python;c:\kivy\gstreamer\bin;c:\kivy\MinGW\bin;%PATH%

  • When creating a new project intended to use kivy, just specify the appropriate interpreter and you should be ready to go

I think it's just pointing that:

After following instructions above I was still having problems with imports not found. I found I had to open my project's properties in Eclipse and under "PyDev - PYTHONPATH" add my kivy directory, e.g. C:\Kivy141\kivy

As of kivy 1.9.0, PATH must also include c:\kivy\SDL2\bin or else when trying to run kivy will throw an error and fail at opening a window. I Think I read that kivy no longer use PyGame and shifted to SDL2 since the answer posted in april 2012.

I am using Windows 7 x64 with Eclipse Mars(release 4.5.1). The steps that worked for me(very close to Rabih answer):
1. I copied Kivy 1.9.0 on my local machine from here
2. I renamed the kivy.bat file to python.bat(this step can be ignored)
3. Eclipse->Window->Preferences->PyDev->Interpreters->Python Interpreter->New
and added the python.bat file as interpreter. After doing this the interpreter should look like in the image:


4. In the Environement tab add the 3 keys everybody mentioned:
GST_REGISTRY = c:\kivy\gstreamer\registry.bin
GST_PLUGIN_PATH = c:\kivy\gstreamer\lib\gstreamer-0.10
PATH = c:\kivy;c:\kivy\Python;c:\kivy\gstreamer\bin;c:\kivy\MinGW\bin;%PATH%
5. Use the interpreter that you just created in your project. Note that a default one will be selected if you don't specify the one you created

Using Eclipse IDE with Kivy and Pydev on OS X

  • Type which ivy in the terminal and locate the executable (it should be /usr/local/bin/kivy)
  • Then choose Preferences from Eclipse menu and navigate to PyDev -> Interpreters -> Python Interpreter.
  • Open the Select Interpreter dialog by clicking on the New... button (1) on the right.
  • Fill the name of interpreter (kivy) in the Interpreter Name field (2)
  • Fill the identified path (/usr/local/bin/kivy) in the Interpreter Executable field
  • Press OK and wait till the process will be done.
  • Do not forget to change interpreter settings in your project. You can do it by right click on your project in the Package Explorer under the PyDev - Interpreter/Grammar page.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!