ModuleNotFoundError:没有名为“ imageai”的模块

时间:2018-10-30 18:48:52

标签: python python-3.x pycharm

我正试图在Pycharm中为python安装对象检测或imageai。我完成了所有安装方法,但这向我显示错误ModuleNotFoundError: No module named 'imageai'


这是我的代码

from imageai.Prediction import ImagePrediction
import os
execution_path = os.getcwd()


prediction = ImagePrediction()
prediction.setModelTypeAsResNet()
prediction.setModelPath(os.path.join(execution_path, "resnet50_weights_tf_dim_ordering_tf_kernels.h5"))
prediction.loadModel()


predictions, probabilities = prediction.predictImage(os.path.join(execution_path, "1.jpg"), result_count=5 )
for eachPrediction, eachProbability in zip(predictions, probabilities):
    print(eachPrediction , " : " , eachProbability)

我需要做什么来解决它? 我是python的新手,请帮助我。


输出

 Traceback (most recent call last):
  File "C:/Python37/files/FirstPrediction/FirstPrediction.py", line 1, in <module>
    from imageai.Prediction import ImagePrediction
ModuleNotFoundError: No module named 'imageai'

C:\Users\משתמש>pip show imageai
Name: imageai
Version: 2.0.2
Summary: A flexible Computer Vision and Deep Learning library for applications and systems.
Home-page: https://moses.specpal.science
Author: Moses Olafenwa and John Olafenwa
Author-email: UNKNOWN
License: MIT
Location: c:\python37\lib\site-packages
Requires:
Required-by:

C:\Users\משתמש>pip -V
pip 18.1 from c:\python37\lib\site-packages\pip (python 3.7)

4 个答案:

答案 0 :(得分:1)

Terensflow不支持Python 3.7,需要下载python 3.6并卸载python 3.7并使用python 3.6进行安装

答案 1 :(得分:1)

您首先需要从这里下载ImageAI whl文件。 https://github.com/OlafenwaMoses/ImageAI/releases/download/2.0.2/imageai-2.0.2-py3-none-any.whl

运行

pip install imageai-2.0.2-py3-none-any.whl

答案 2 :(得分:1)

此外,您可以直接从PyPi安装 ImageAI

pip3 install imageai --upgrade

答案 3 :(得分:-1)

$ g++ -std=c++14 GuessNumber.cpp -o test
In file included from GuessNumber.cpp:2:0:
/usr/lib/gcc/x86_64-pc-cygwin/7.3.0/include/c++/array: In instantiation of ‘struct std::array<int, 2305843009213693952>’:
GuessNumber.cpp:15:9:   recursively required from ‘void fn(std::array<_Tp, _Nm>&) [with T = int; long unsigned int Size = 2]’
GuessNumber.cpp:15:9:   required from ‘void fn(std::array<_Tp, _Nm>&) [with T = int; long unsigned int Size = 5]’
GuessNumber.cpp:21:11:   required from here
/usr/lib/gcc/x86_64-pc-cygwin/7.3.0/include/c++/array:94:12: error: size of type ‘std::array<int, 2305843009213693952>’ is too large (‘9223372036854775808’ bytes)
     struct array
            ^~~~~