- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
我正在尝试让一些 Python 代码在使用 Python 2.7 的 Mac OS X Mojave 上的 Anaconda 上进行全新安装。这是以前在同一台机器上工作的所有东西。
我得到的错误是这样的:
Mac:~ kuzzooroo$ python
Python 2.7.15 |Anaconda, Inc.| (default, Dec 14 2018, 13:10:39)
[GCC 4.2.1 Compatible Clang 4.0.1 (tags/RELEASE_401/final)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import AppKit
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named AppKit
小写也不起作用:
>>> import appkit
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/kuzzooroo/anaconda2/lib/python2.7/site-packages/appkit/__init__.py", line 11, in <module>
from AppKit import _metadata
ImportError: No module named AppKit
我进行了大量搜索,关于如何处理此错误的建议大多采用“确保您已安装 X”的形式。这是我得到的:
Mac:~ kuzzooroo$ brew install PyGObject PyGObject3
Warning: pygobject 2.28.7_1 is already installed and up-to-date
To reinstall 2.28.7_1, run `brew reinstall pygobject`
Warning: pygobject3 3.30.4 is already installed and up-to-date
To reinstall 3.30.4, run `brew reinstall pygobject3`
Mac:~ kuzzooroo$ pip install AppKit PyObjC PyObjC-core
Requirement already satisfied: AppKit in ./anaconda2/lib/python2.7/site-packages (0.2.8)
Requirement already satisfied: PyObjC in ./anaconda2/lib/python2.7/site-packages (5.1.2)
Requirement already satisfied: PyObjC-core in ./anaconda2/lib/python2.7/site-packages (5.1.2)
Requirement already satisfied: ... <many more lines>
brew install
步骤改变了错误,但如您所见,它们并没有给我留下一个有效的设置。
最佳答案
事实证明有人编写了一个名为 AppKit 的包,它是完全不同的 Mac 操作系统组件。这是另一个 AppKit:
$ pip search appkit
AppKit (0.2.8) - Desktop application framework based on Webkit HTML5, CSS3, Javascript and Python
除了 PyObjC 之外,安装它会产生冲突,导致出现无用的错误消息 No module named AppKit
(实际上,有两个东西以这个名称运行)。
运行 conda uninstall AppKit
然后 pip install --upgrade --force-reinstall PyObjC PyObjC-core
解决了这个问题。
关于python - 安装 AppKit 和 PyObjC 后 `ImportError: No module named AppKit`,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53808723/
我不小心安装了 pyobjc 2.2 和 easy-install pyobjc,这导致了问题:当我尝试导入它时出现错误 Incompatible library version: _objc.so
我构建了一个 pyobjc 应用程序,发现它似乎需要很长时间才能加载。 我添加了日志记录来测量加载每个步骤所需的时间。在进入 AppHelper.runEventLoop() 之前,应用程序需要花费
我正在尝试使用 PyObjC 制作一个应用程序,并且正在努力寻找如何记录箭头键(向左和向右)。我希望能够记录用户每次按下左右箭头键的时间。我正在使用网上找到的另一个例子。我想使用键盘上的箭头键,而不是
编辑:感谢您的建议。我仍然不清楚自动释放池的实际处理方式。 这是实际的代码: import platform, time if (platform.system().lower() == "darwi
我已经在 Mac 上安装了 PyObjC,但我根本无法让它工作。即使尝试导入 AddressBook 类也会立即失败。 Python 2.7.2 (v2.7.2:8527427914a2, Jun 1
我理解 PyObjC 的概念,但找不到任何关于它到底是什么或如何开始使用它的信息。 它是否像一个转换器,您可以在其中输入 python 文件并获得一个 objective c 文件?或者它是一个你可以
Xcode最强大的功能之一就是Intellisense completion,当您键入Foundation/Cocoa/UIKit API的名称时,它会弹出一个潜在候选列表。我对MacRuby,PyO
我正在使用此层次结构在 PyObjC 中以编程方式创建一个菜单。 NSMenu (setMainMenu on NSApplication) - NSMenuItem(1) - NSMenu: "
官方文档说可以在Python代码中使用自定义 block ,但需要创建元数据。我还没有找到这样的例子。 我的问题是如何创建、使用和分发自定义 block 的元数据。 示例 @interface Som
我正在尝试为 NSWebView 实现一个委托(delegate),但是当我运行它时,我得到了这个错误: TypeError: Error when calling the metaclass bas
当我在 pyObjC 代码中调用 setDelegate_ 时,我收到 AttributeError: 'tuple' object has no attribute 'setDelegate_'。
我正在尝试根据 the KVC guide 在 Python 中为我的模型类实现索引访问器方法。 .出于性能原因,我想使用可选的范围方法一次加载多个对象。该方法采用指向 C 数组缓冲区的指针,我的方法
在 OSX Maverick 上,我有这个基于 PyObjC(python3.3) 的简单 APP test.py class MyDelegate(NSObject): def applicatio
我正在学习如何使用 pyobjc 进行一些基本原型(prototype)制作。现在我有一个主 UI 设置和一个运行主应用程序的 python 脚本。唯一的问题是当脚本运行时,脚本在主线程上运行从而阻塞
如何使用 PyObjC 获取全局滚动事件?可以通过 NSEvent 调用来完成吗? 示例代码会很棒... 最佳答案 您的 NSEvent 走在正确的轨道上!只要您不想修改事件,而只是观察它,就像调用
我正在尝试在 Cocoa PyObjc 项目中使用来自 BWToolkit 的 Brandon Walkin 的 BWSplitView。当我运行该项目时,我收到以下错误消息: NSInvalidUn
我正处于开发跨平台(Mac 和 Windows)应用程序的规划阶段。性能不是问题,Python 非常适合问题领域。我是一名具有 pyojc 经验的 Cocoa 开发人员。 Cocotron 看起来很吸
我想为我正在设计的应用程序使用 NSOpenPanel。这是我到目前为止所拥有的: @objc.IBAction def ShowOpenPanel_(self, sender): self.
关闭。这个问题是opinion-based .它目前不接受答案。 想要改进这个问题吗? 更新问题,以便 editing this post 提供事实和引用来回答它. 关闭 9 年前。 Improve
我将在 Mac App Store 中销售一个使用该框架的程序。我想确保它能得到 Apple 的批准。 最佳答案 是的。 $ /usr/bin/python2.6 Python 2.6.1 (r261
我是一名优秀的程序员,十分优秀!