Python 未找到PIL、枕头、图像、cv2模块
我在mac电脑上运行,在枕头工作时遇到了问题 我的版本是:Python 未找到PIL、枕头、图像、cv2模块,python,pillow,Python,Pillow,我在mac电脑上运行,在枕头工作时遇到了问题 我的版本是: python - 2.7.6 pip - 9.0.1 Pillow - 4.0.0 我跑: pip install Pillow pip install PIL pip install numpy 我已卸载所有并重新尝试;但似乎一切都不起作用 我使用: from PIL import Image 或 两者都不起作用。当我运行“pip show--文件枕头”时,我所有的PIL和枕头文件都会显示出来 我还尝试使用此处发布的说明安装cv
python - 2.7.6
pip - 9.0.1
Pillow - 4.0.0
我跑:
pip install Pillow
pip install PIL
pip install numpy
我已卸载所有并重新尝试;但似乎一切都不起作用
我使用:
from PIL import Image
或
两者都不起作用。当我运行“pip show--文件枕头”时,我所有的PIL和枕头文件都会显示出来
我还尝试使用此处发布的说明安装cv2:
我的错误是:
Python 2.7.6 (v2.7.6:3a1db0d2747e, Nov 10 2013, 00:42:54)
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from PIL import Image
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named PIL
>>> import Image
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named Image
>>> import cv2
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named cv2
Python 2.7.6(v2.7.6:3a1db0d2747e,2013年11月10日,00:42:54)
[GCC 4.2.1(苹果公司建造5666)(dot 3)]关于达尔文
有关详细信息,请键入“帮助”、“版权”、“信用证”或“许可证”。
>>>从PIL导入图像
回溯(最近一次呼叫最后一次):
文件“”,第1行,在
ImportError:没有名为PIL的模块
>>>导入图像
回溯(最近一次呼叫最后一次):
文件“”,第1行,在
ImportError:没有名为Image的模块
>>>进口cv2
回溯(最近一次呼叫最后一次):
文件“”,第1行,在
ImportError:没有名为cv2的模块
关于我做错了什么有什么建议吗?我一直在做一些核心研究,最后终于找到了工作。我可能(意外地)仍在运行多个python,但我运行了以下命令:
sudo easy_install http://dist.plone.org/thirdparty/PIL-1.1.7.tar.gz
现在“从PIL导入图像”工作了
我通过这个关于virtualenv的问题找到了这个答案。虽然我最终并没有使用virtualenv,但它还是让我下了决心
我在过去的几个小时里一直在琢磨一个类似的问题,最后通过将文件复制到python库的文件夹中(我使用的是anaconda),使模块正常工作
请仔细检查模块的安装位置。是否有可能安装了多个Python版本?当你使用pip安装时,你确认没有错误吗?@BrianO'Donnell老实说,我想是的(偶然),但我不知道如何找到它们并删除它们
Python 2.7.6 (v2.7.6:3a1db0d2747e, Nov 10 2013, 00:42:54)
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from PIL import Image
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named PIL
>>> import Image
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named Image
>>> import cv2
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named cv2
sudo easy_install http://dist.plone.org/thirdparty/PIL-1.1.7.tar.gz