【问题标题】:Beginner cannot access python's imrotate初学者无法访问python的imrotate
【发布时间】:2020-02-02 15:53:26
【问题描述】:

我用谷歌搜索了“python 旋转图像”,它把我送到了 scipy.misc.imrotate。然后我导入了 scipy 和 scipy.misc

import scipy.misc as misc

失败。我不知道为什么,但是当我没有尝试重命名时它起作用了。 help('scipy.misc') 将 imrotate 列为可用功能,但表示需要“枕头”。所以我回到 Macos Unix shell 并输入

pip3 install pillow

这很有效。但我仍然从 python3 得到一个错误

scipy.misc.imrotate
>>> scipy.misc.imrotate
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: module 'scipy.misc' has no attribute 'imrotate'

【问题讨论】:

  • The documentation 表示已弃用,将在 scipy 1.2 中删除。
  • 如果你使用导入语句import scipy.misc as misc,那么你必须使用misc.imrotate(不是scipy.misc.imrotate)来访问imrotate函数。
  • @MrT 究竟是什么被弃用了。
  • @WarrenWeckesser:谢谢。我尝试了您的建议,然后输入了 misc.imrotate。这给出了一条错误消息 AttributeError: module 'scipy.misc' has no attribute 'imrotate'
  • @DavidEpstein 以后将不再支持。所以如果你今天写了一个脚本,只想在接下来的两周内使用它,你不必关心它。但如果您希望此脚本在三年内运行,最好使用建议的替代方案。

标签: python-3.x scipy


【解决方案1】:

imrotate 已弃用! imrotate 在 SciPy 1.0.0 中已弃用,并在 1.2.0 中被删除。 您可以改用 skimage.transform.rotate。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-08-17
    • 1970-01-01
    • 1970-01-01
    • 2023-02-22
    相关资源
    最近更新 更多