如何在Windows上为PyCharm配置Python Kivy? [英] How to configure Python Kivy for PyCharm on Windows?

查看:370
本文介绍了如何在Windows上为PyCharm配置Python Kivy?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我很难让Kivy在Windows 7上使用PyCharm.我设法通过文件">设置">"Python解释器">路径"选项卡添加了大多数外部库.

I'm having trouble getting Kivy to work with PyCharm on Windows 7. I've managed to add most of the external libraries through File > Settings > Python interpreters > Paths Tab.

我正在使用Kivy版本的Python. 当我运行一个在PyCharm中使用[右键单击>发送到> kivy.bat]方法可以正常工作的Kivy应用程序时,它给了我这个错误:

I'm using the Kivy version of Python. When I run a Kivy app that works fine with using the [right click > send to > kivy.bat] method in PyCharm, it gives me this error:

Failed modules
Python 2.7.3 (C:/Python27/python.exe) 
_imagingtk
dde
gtk._gtk
pangocairo
Generation of skeletons for the modules above will be tried again when the modules are updated or a new version of generator is available

我认为问题可能与cython有关,因为我的文件无法识别cyvy * .pxd格式的kivy.properties文件.

I think that the problem might by something to do with cython, as my file fails to recognise the kivy.properties file, which is of the Cython *.pxd format.

如果有人可以将我引向PyCharm和Kivy的Windows配置教程,或者为我提供解决问题的方法,我将不胜感激!

If someone could please pointer me over to a windows config tutorial for PyCharm and Kivy or give me the solution to my problem, I would greatly appreciate it!

推荐答案

此Kivy的Wiki页面

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.

转到解压缩的Kivy文件夹,在同一目录(mklink python.bat kivy.bat)中为"kivy.bat"创建指向"python.bat"的符号链接.

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

在PyCharm中添加2个新的Python解释器.

Add 2 new Python interpreters in PyCharm.

  • 引导程序:从Kivy软件包文件夹中选择先前创建的"python.bat".
  • 项目解释器:从Kivy软件包文件夹中的Python子目录中选择"python.exe".

对于项目解释器,将路径添加到直接包含在Kivy软件包文件夹中的"kivy"目录中.在PyCharm 3.4中,路径"选项卡隐藏在子菜单中.在项目解释器"中,单击解释器下拉列表旁边的工具图标,单击更多..."(最后一个),在所有项目解释器的列表中,选择运行配置解释器",在右侧有五个图标(+ ,-,编辑,虚拟环境和路径),单击路径以在解压缩的Kivy文件夹中添加Kivy子目录.

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.

创建一个新的运行配置,并将Python解释器设置为我们先前创建的引导程序.

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

只需运行配置以执行您的Kivy应用程序

Simply run the configuration to execute your Kivy application

这篇关于如何在Windows上为PyCharm配置Python Kivy?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆