【问题标题】:ImportError: No module named enum on Mac Python 2.7.10ImportError:Mac Python 2.7.10 上没有名为 enum 的模块
【发布时间】:2019-11-12 08:34:39
【问题描述】:

我已经尝试在我的 Mac 上安装 enum、enum34 和 aenum,但我无法将这些包导入我的代码或交互式 shell。 但我可以在pip freeze 上找到这些包。

基本上我想运行 https://github.com/kcoley/gltf2usd 。

iMAC:Source JK$ pip install enum
DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7.
Collecting enum
Requirement already satisfied: setuptools in /usr/local/lib/python2.7/site-packages (from enum) (41.0.1)
Installing collected packages: enum
Successfully installed enum-0.4.7

from enum import Enum
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named enum

【问题讨论】:

  • 检查this 或this。您可能需要强制重新安装 enum34 软件包:pip install --ignore-installed enum34
  • 谢谢@MassoodKhaari 在 CentOS 8 上遇到了类似的问题,而 pip install --ignore-installed enum34 是唯一对我有用的东西。在看到你的评论之前我差点给了。

标签: python python-2.7 enums macos-mojave usdz


【解决方案1】:

我找不到任何解决方案,但现在,我将枚举从 https://bitbucket.org/stoneleaf/enum34/src/default/enum/__init__.py 复制到我的本地文件夹中。

【讨论】:

  • 可以指定本地文件夹的路径吗?
  • 哪一种蟒蛇?它的:/usr/bin/python
  • 我使用 Python 3.7.3
  • 抱歉,您将枚举复制到了哪个文件夹中?在 ~/miniconda3/lib/python3.7/site-packages 下?
  • 不,只是复制到我的项目文件夹中。幸运的是,它不能用于商业目的。 @敏捷豆
猜你喜欢
  • 2017-01-12
  • 2013-02-11
  • 2014-05-05
  • 1970-01-01
  • 2019-04-29
  • 2020-05-11
  • 1970-01-01
  • 2018-05-23
  • 1970-01-01
相关资源
最近更新 更多