没有名为 'imgurpython' 的模块
No module named 'imgurpython'
我正在尝试使用官方 python 库在我的 raspberry pi 上调用 imgur API。我已经使用 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()
正如用户 /users/5963631/jonas 所说,显然我必须使用 pip3 来安装模块。
我正在尝试使用官方 python 库在我的 raspberry pi 上调用 imgur API。我已经使用 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()
正如用户 /users/5963631/jonas 所说,显然我必须使用 pip3 来安装模块。