AttributeError:'module'对象没有属性'Number'

时间:2016-08-01 16:22:01

标签: pillow

不确定是什么导致这个......

我使用“Pillow-3.3.0.win32-py34.exe”安装文件运行Python 3.4.3。

导入图像

from PIL import Image

我尝试使用

将“a.jpg”设置为我的图像
img = Image.open("a.jpg")

但是我收到了这个错误,

>>> img = Image.open("a.jpg")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Python34\lib\site-packages\PIL\Image.py", line 2289, in open
    preinit()
  File "C:\Python34\lib\site-packages\PIL\Image.py", line 365, in preinit
    from PIL import JpegImagePlugin
  File "C:\Python34\lib\site-packages\PIL\JpegImagePlugin.py", line 40, in <modu
le>
    from PIL import Image, ImageFile, TiffImagePlugin, _binary
  File "C:\Python34\lib\site-packages\PIL\TiffImagePlugin.py", line 50, in <modu
le>
    from fractions import Fraction
  File "C:\Python34\lib\fractions.py", line 6, in <module>
    from decimal import Decimal
  File "C:\Python34\lib\decimal.py", line 3855, in <module>
    _numbers.Number.register(Decimal)
AttributeError: 'module' object has no attribute 'Number'

可能与Pillow无关,但仍然非常感谢帮助!

1 个答案:

答案 0 :(得分:6)

当前工作目录中是否有名为composer global require "fxp/composer-asset-plugin:~1.1.1" 的文件?

这可能是问题的原因,因为它会阻止导入标准库模块numbers

(来自here的建议。)

相关问题