python - 在 Mac OS/X 1.8.5 中为 Python 2.7 安装 Twisted

标签 python macos installation twisted

一些版本,首先:

mac osx 版本:

$ system_profiler SPSoftwareDataType
Software:

    System Software Overview:

      System Version: OS X 10.8.5 (12F45)
      Kernel Version: Darwin 12.5.0
      Boot Volume: Macintosh HD
      Boot Mode: Normal

python :

$ python
Python 2.7.2 (default, Oct 11 2012, 20:14:37)
[GCC 4.2.1 Compatible Apple Clang 4.0 (tags/Apple/clang-418.0.60)] on darwin

zope:

>>> import zope
>>> zope.__path__
['/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/zope', '/Library/Python/2.7/site-packages/zope.interface-4.1.1-py2.7-macosx-10.8-intel.egg/zope']

所以.. Max 1.8.5 与 python 2.7 和 zope 4.1

那么..问题:

>>> import twisted
    Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Library/Python/2.7/site-packages/twisted/__init__.py", line 53, in <module>
    _checkRequirements()
  File "/Library/Python/2.7/site-packages/twisted/__init__.py", line 51, in _checkRequirements
    raise ImportError(required + ".")
ImportError: Twisted requires zope.interface 3.6.0 or later.

可以肯定的是,我在 sudo 执行 python setup.py install、easy_install、pip 和其他命令时搞砸了一些事情,但是……问题是:

如何安装更新版本的 twisted?

最佳答案

OS X 10.8 附带 Zope Interface 3.5.1。但是,当您将 Twisted 安装到 /Library 时,您并没有同时安装更新的可导入版本的 Zope Interface。

删除您安装的 Twisted 版本。 OS X 10.8 已经附带了 Twisted 12.0,这对于您正在做的事情来说可能已经足够好了。如果您需要更新的版本,请将其安装到 virtualenv 中并在那里使用它。 https://pip2014.com/可以让您开始使用必要的工具来执行此操作, sudo ;-)

不会搞砸您的系统

关于python - 在 Mac OS/X 1.8.5 中为 Python 2.7 安装 Twisted,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25969492/

相关文章:

python asyncio - ctrl+c 上的清理事件循环?和 close() 与 stop()

python - 对从 Google Vision API 中提取为完整单词的文本进行分组

macos - rsync 备份到外部硬盘 exFat 失败

java - 在 Spring Boot 中使用系统变量

installation - 重大升级 - .exe 文件未重新安装

python - 为什么从一个模块中导入一个函数比整个模块本身需要更长的时间?

python - 在matplotlib、python中画几张图

macos - 检查工作表是否打开

python - Pygame 已经安装;但是,python 终端说 "No module named ' pygame'"(Ubuntu 20.04.1)

opencv - 使用 NSIS 创建 OpenCV 安装程序