搭建开发环境:PyCharm、python-gtk、windows [英] Setting up developement environment: PyCharm, python-gtk, windows

查看:71
本文介绍了搭建开发环境:PyCharm、python-gtk、windows的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用这些工具进行开发:

  • MS-Windows 10
  • Python3
  • gtk
  • PyCharm

我安装了 PyCharm,但到现在为止还没有安装 Python 和 gtk.

子问题:

  • 使用 32 位或 64 位版本的 Python?
  • 如何为 python(pip 或 exe)安装 gtk?
  • 在 PyCharm 中使用虚拟环境还是使用现有解释器"?

AFAIK 你不能用 pip 在 Windows 上安装 gtk for Python.

更新

我现在遵循本指南:https://pygobject.readthedocs.io/en/latest/getting_started.html#windows-getting-started

更新 2

Windows 上的 gtk 似乎很少使用.有很多奇怪的东西,我现在用pyside2(QT),我很高兴

解决方案

使用 32 位或 64 位版本的 Python?

文档建议 msys2 使用 32 位,因此这是最安全的.但是,如果您拥有 64 位计算机,则 64 位版本可以为更大的任务提供更多处理能力.

<块引用>

如何为python(pip或exe)安装gtk?

绝对使用此来源提供的 .exe.这个工具是 Windows 的包管理器,可以让你安装 gtk 及其依赖项.那里的说明将引导您设置默认环境,然后从该环境运行 pacman -Suypacman -S mingw-w64-i686-gtk3 mingw-w64-i686-python2-gobjectmingw-w64-i686-python3-gobject.

<块引用>

在 PyCharm 中使用虚拟环境还是使用现有解释器"?

对于这种安装方法,必须使用现有的解释器",因为您需要将 PyCharm 指向您的 msys2 Python,它实际上有 gtk 可用.它应该位于 C:\msys64\bin\python.exe.请记住,您可能无法以这种方式直接通过 PyCharm 运行某些脚本,因为 Python 将在类似 bash 的虚拟环境中运行.将您的脚本保存在 C:\msys64\home\ 目录中,以便您在使用 python3 script.py 打开 msys2 时可以轻松运行它们.>

I want to develop with these tools:

  • MS-Windows 10
  • Python3
  • gtk
  • PyCharm

I installed PyCharm, but up to now Python and gtk are not installed up to now.

Sub questions:

  • use 32 or 64 Bit version of Python?
  • How to install gtk for python (pip or exe)?
  • Use virtual env in PyCharm or use "Existing Interpreter"?

AFAIK you cant install gtk for Python on Windows with pip.

Update

I follow this guide now: https://pygobject.readthedocs.io/en/latest/getting_started.html#windows-getting-started

Update2

gtk on windows seems to be hardly used. There were many strange things, and I use pyside2 (QT) now and I am happy

解决方案

use 32 or 64 Bit version of Python?

The documentation suggests 32 bit for msys2, so this is the safest. However, if you have a 64 bit computer, the 64 bit version could allow some more processing power for larger tasks.

How to install gtk for python (pip or exe)?

Most definitely using the .exe available from this source. This tool is a package manager for Windows that will let you install gtk and its dependencies. Instructions there will walk you through setting up the default environment, then from that environment run pacman -Suy and pacman -S mingw-w64-i686-gtk3 mingw-w64-i686-python2-gobject mingw-w64-i686-python3-gobject.

Use virtual env in PyCharm or use "Existing Interpreter"?

Using the 'Existing Intepreter' is a must for this method of installation, as you need to point PyCharm to your msys2 Python, which actually has gtk available. It should be located at C:\msys64\bin\python.exe. Keep in mind that you might not be able to run some scripts directly through PyCharm this way, as Python will be running through a virtual bash-like environment. Save your scripts in the C:\msys64\home\<username> directory so that you can run them easily when you open msys2 with python3 script.py.

这篇关于搭建开发环境:PyCharm、python-gtk、windows的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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