Нет модуля с именем imgurpython - PullRequest
0 голосов
/ 28 ноября 2018

Я пытаюсь вызвать imgur API на моем raspberry pi, используя официальную библиотеку python.Я установил его с помощью pip, но скрипт, похоже, не распознает его.Есть идеи, почему?

pi@raspberrypi:~/School $ pip install imgurpython
Collecting imgurpython
Collecting requests (from imgurpython)
   Using cached https://files.pythonhosted.org/packages/ff/17/5cbb026005115301a8fb2f9b0e3e8d32313142fe8b617070e7baad20554f/requests-2.20.1-     py2.py3-none-any.whl
   Collecting urllib3<1.25,>=1.21.1 (from requests->imgurpython)
   Using cached https://files.pythonhosted.org/packages/62/00
`--------------------------------------´
Python installing python stuff
`--------------------------------------´
Installing collected packages: urllib3, idna, chardet, certifi, requests,     imgurpython
Successfully installed certifi-2018.10.15 chardet-3.0.4 idna-2.7 imgurpython-1.1.7 requests-2.20.1 urllib3-1.24.1

pi@raspberrypi:~/School $ python3 Camera_LabFarm_Script.py
Traceback (most recent call last):
  File "Camera_LabFarm_Script.py", line 5, in <module>
from imgurpython import ImgurClient
ImportError: No module named 'imgurpython'

Код в "Camera_LabFarm_Script.py"

#!/usr/bin/env/ python
from datetime import datetime
from threading import Timer
from picamera import PiCamera
from imgurpython import ImgurClient

import configparser
camera = PiCamera()

camera.contrast = 60
camera.brightness = 60

config = configparser.ConfigParser()
config.read('auth.ini')
client_id = config.get('credentials', 'client_id')
client_secret = config.get('credentials', 'client_secret')

def WaitADay():
    x = datetime.today()
    y = x.replace(day=x.day+1, hour=12, minute=0, second=0, microsecond=0)
    delta_t = y-x
    secs = delta_t.seconds+1
    t = Timer(secs, TakePicture)
    print("Next picture will be taken on" + y.strftime(" %c"))
    t.start()

def TakePicture():
    print("Taking today's picture...")

    MoveCamera(1)
    camera.capture("/home/labfarm1/img")
    MoveCamera(2)
    camera.capture("/home/labfarm2/img")
    MoveCamera(3)
    camera.capture("/home/labfarm3/img")
    WaitADay()

def MoveCamera(loc):
    pass

print("Starting the program...")
  WaitADay()

1 Ответ

0 голосов
/ 28 ноября 2018

Как сказал пользователь / users / 5963631 / jonas, очевидно, мне пришлось использовать pip3 для установки модуля.

...