[PYTHON] Pyenv auf Raspberry Pi eingeführt

Hintergrund

Bei der Verwendung des Python-SDK, das ich mit Raspberry Pi zur Überprüfung von Amazon IoT verwenden möchte, ist eine Fehlermeldung aufgetreten.

pi@raspberrypi:~/iot $ ./start.sh 

Downloading AWS IoT Root CA certificate from Symantec...
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  1758  100  1758    0     0  12381      0 --:--:-- --:--:-- --:--:-- 12468

Installing AWS SDK...
Cloning into 'aws-iot-device-sdk-python'...
remote: Counting objects: 116, done.
remote: Compressing objects: 100% (19/19), done.
remote: Total 116 (delta 3), reused 15 (delta 3), pack-reused 92
Receiving objects: 100% (116/116), 117.74 KiB | 0 bytes/s, done.
Resolving deltas: 100% (35/35), done.
Checking connectivity... done.
~/iot/aws-iot-device-sdk-python ~/iot
running install
running build
running build_py
creating build
creating build/lib.linux-armv7l-2.7
creating build/lib.linux-armv7l-2.7/AWSIoTPythonSDK
copying AWSIoTPythonSDK/MQTTLib.py -> build/lib.linux-armv7l-2.7/AWSIoTPythonSDK
copying AWSIoTPythonSDK/__init__.py -> build/lib.linux-armv7l-2.7/AWSIoTPythonSDK
creating build/lib.linux-armv7l-2.7/AWSIoTPythonSDK/core
copying AWSIoTPythonSDK/core/__init__.py -> build/lib.linux-armv7l-2.7/AWSIoTPythonSDK/core
creating build/lib.linux-armv7l-2.7/AWSIoTPythonSDK/exception
copying AWSIoTPythonSDK/exception/operationTimeoutException.py -> build/lib.linux-armv7l-2.7/AWSIoTPythonSDK/exception
copying AWSIoTPythonSDK/exception/AWSIoTExceptions.py -> build/lib.linux-armv7l-2.7/AWSIoTPythonSDK/exception
copying AWSIoTPythonSDK/exception/operationError.py -> build/lib.linux-armv7l-2.7/AWSIoTPythonSDK/exception
copying AWSIoTPythonSDK/exception/__init__.py -> build/lib.linux-armv7l-2.7/AWSIoTPythonSDK/exception
creating build/lib.linux-armv7l-2.7/AWSIoTPythonSDK/core/shadow
copying AWSIoTPythonSDK/core/shadow/shadowManager.py -> build/lib.linux-armv7l-2.7/AWSIoTPythonSDK/core/shadow
copying AWSIoTPythonSDK/core/shadow/deviceShadow.py -> build/lib.linux-armv7l-2.7/AWSIoTPythonSDK/core/shadow
copying AWSIoTPythonSDK/core/shadow/__init__.py -> build/lib.linux-armv7l-2.7/AWSIoTPythonSDK/core/shadow
creating build/lib.linux-armv7l-2.7/AWSIoTPythonSDK/core/util
copying AWSIoTPythonSDK/core/util/sigV4Core.py -> build/lib.linux-armv7l-2.7/AWSIoTPythonSDK/core/util
copying AWSIoTPythonSDK/core/util/offlinePublishQueue.py -> build/lib.linux-armv7l-2.7/AWSIoTPythonSDK/core/util
copying AWSIoTPythonSDK/core/util/__init__.py -> build/lib.linux-armv7l-2.7/AWSIoTPythonSDK/core/util
copying AWSIoTPythonSDK/core/util/progressiveBackoffCore.py -> build/lib.linux-armv7l-2.7/AWSIoTPythonSDK/core/util
creating build/lib.linux-armv7l-2.7/AWSIoTPythonSDK/core/protocol
copying AWSIoTPythonSDK/core/protocol/__init__.py -> build/lib.linux-armv7l-2.7/AWSIoTPythonSDK/core/protocol
copying AWSIoTPythonSDK/core/protocol/mqttCore.py -> build/lib.linux-armv7l-2.7/AWSIoTPythonSDK/core/protocol
creating build/lib.linux-armv7l-2.7/AWSIoTPythonSDK/core/protocol/paho
copying AWSIoTPythonSDK/core/protocol/paho/client.py -> build/lib.linux-armv7l-2.7/AWSIoTPythonSDK/core/protocol/paho
copying AWSIoTPythonSDK/core/protocol/paho/__init__.py -> build/lib.linux-armv7l-2.7/AWSIoTPythonSDK/core/protocol/paho
creating build/lib.linux-armv7l-2.7/AWSIoTPythonSDK/core/protocol/paho/securedWebsocket
copying AWSIoTPythonSDK/core/protocol/paho/securedWebsocket/securedWebsocketCore.py -> build/lib.linux-armv7l-2.7/AWSIoTPythonSDK/core/protocol/paho/securedWebsocket
copying AWSIoTPythonSDK/core/protocol/paho/securedWebsocket/__init__.py -> build/lib.linux-armv7l-2.7/AWSIoTPythonSDK/core/protocol/paho/securedWebsocket
running install_lib
creating /usr/local/lib/python2.7/dist-packages/AWSIoTPythonSDK
error: could not create '/usr/local/lib/python2.7/dist-packages/AWSIoTPythonSDK': Permission denied
pi@raspberrypi:~/iot $ sudo ./start.sh                                                                                                                                                                                                    

Running pub/sub sample application...
Traceback (most recent call last):
  File "aws-iot-device-sdk-python/samples/basicPubSub/basicPubSub.py", line 18, in <module>
    from AWSIoTPythonSDK.MQTTLib import AWSIoTMQTTClient
ImportError: No module named AWSIoTPythonSDK.MQTTLib

Es scheint, dass es kein AWSIoTPython SDK gibt Ich habe den folgenden Befehl ausgeführt, aber ich habe die Fehlermeldung erhalten, dass pip nicht enthalten war.

$ sudo pip install AWSIoTPythonSDK

Die Version von Python ist in erster Linie alt.

$ python -V
2.7.9

Installieren Sie pyenv

Installieren Sie die erforderlichen Pakete.

$ sudo apt-get install -y git openssl libssl-dev libbz2-dev libreadline-dev libsqlite3-dev

Klon pyenv.

$ git clone git://github.com/yyuu/pyenv.git ~/.pyenv

Fügen Sie nach dem Klonen die Einstellung zu ".bash_profile" hinzu.

$ sudo vi ~/.bash_profile

#Folgende Inhalte wurden hinzugefügt
export PYENV_ROOT="$HOME/.pyenv"
export PATH="$PYENV_ROOT/bin:$PATH"
eval "$(pyenv init -)"

Reflektieren Sie die Einstellungen.

$ sudo source ~/.bash_profile

Überprüfen Sie die installierbaren Python-Pakete.

$ pyenv install --list
.
.
.
3.0.1
3.1
3.1.1
.
.
.

Installieren Sie Python 3.6.2 mit pyenv

Installieren Sie Python3.6.2 und wechseln Sie die Versionen

$ pyenv install 3.6.2
$ pyenv global 3.6.2

Rohrinstallation

$ curl -O https://bootstrap.pypa.io/get-pip.py
$ python get-pip.py

Installieren Sie das AWS IoT Python SDK mit pip

$ pip install AWSIoTPythonSDK

Herstellen einer Verbindung zu AWS IoT

$ pi@raspberrypi:~/iot $ ./start.sh 

Es war erfolgreich.

Recommended Posts

Pyenv auf Raspberry Pi eingeführt
Cython auf Raspberry Pi
Einführung von Ceph mit Kubernetes auf Raspberry Pi 4B (ARM64)
Verwenden Sie NeoPixel mit Himbeerkuchen
Installieren Sie OpenCV4 auf Raspberry Pi 3
Installieren Sie TensorFlow 1.15.0 auf Raspberry Pi
Installieren Sie pyenv auf Raspberry Pi, um Python zu verwalten
MQTT auf Raspberry Pi und Mac
Himbeer Pi 4 Centos7 auf Docker installieren
Versuchen Sie es mit ArUco mit Raspberry Pi
OpenCV-Installationsverfahren auf Raspberry Pi
Ein- / Ausschalten von Raspberry Pi mit Arduino
Erkennen Sie den Schalterstatus mit Raspberry Pi 3
Installieren Sie OpenMedia Vault 5 auf Raspberry Pi 4
L Chika mit Himbeer-Pi C #
Erstellen Sie wxPython unter Ubuntu 20.04 auf Himbeer-Pi 4
Raspberry Pi "Honwaka Benachrichtigungslampe" Teil 2
Erkennen Sie "Helligkeit" mit Python auf Raspberry Pi 3!
USB-Boot auf Raspberry Pi 4 Model B.
Raspberry Pi "Honwaka Benachrichtigungslampe" Teil 1
Aktivieren Sie die serielle UART + -Kommunikation mit Raspberry Pi
Adafruit Python BluefruitLE arbeitet mit Raspeye.
Beschleunigen Sie Deep Learning mit der Rasperry Pi 4-CPU
Normal programmieren mit Node-RED-Programmierung mit Raspberry Pi 3
Verwenden Sie den Grove-Sensor mit Raspberry Pi
Installieren Sie das 64-Bit-Betriebssystem (Bate) auf Raspberry Pi
Installieren Sie Docker-Compose unter 64-Bit-Raspberry-Pi-Betriebssystem
Lassen Sie einen Servomotor mit Python auf Raspberry Pi 3 laufen
Raspberry Pi "Honwaka Benachrichtigungslampe" Teil 3
Arbeiten mit Sensoren in Mathematica auf Raspberry Pi
Erstellen Sie eine OpenCV-Python-Umgebung auf Raspberry Pi B +
Ermitteln Sie die Temperatur mit Python auf Raspberry Pi 3!
Matrixmultiplikation auf Raspberry Pi GPU (Teil 2)
So installieren Sie NumPy auf Raspeye
Arbeiten mit GPS in Python für Raspberry Pi 3
Warum DetectMultiScale () auf Raspberry Pi B + langsam ist
Erkennen Sie Schiebeschalter mit Python auf Raspberry Pi 3!
Erstellen Sie eine Django-Umgebung auf Raspai (MySQL)
Versuchen Sie, QR-Code mit Raspberry Pi zu verwenden
Erkennen Sie Magnetschalter mit Python auf Raspberry Pi 3!
Schalten Sie Ihren PC mit Himbeer-Pi ein / aus
Grove - Temperatur- und Feuchtigkeitssensor (DHT11) mit Raspberry Pi
Cross-Compilierung für Raspberry Pi Zero unter Ubuntu gestartet
Lassen Sie den Summer mit Python auf Raspberry Pi 3 erklingen!
Zeigen Sie die CPU-Temperatur alle 5 Sekunden auf dem Raspberry Pi 4 an
Stellen Sie mit Python auf Raspberry Pi eine Verbindung zu MySQL her
Erstellen Sie eine Python-Entwicklungsumgebung auf Raspberry Pi
Erstellen Sie eine Arch Linux-Umgebung auf Raspai
Installieren Sie pyenv auf dem Mac
Was ist Raspberry Pi?
GPGPU mit Raspberry Pi
Pyenv + virtualenv auf dem Mac
Raspberry Pi Videokamera
Lass uns Raspberry Pi machen?
Raspberry Pi 4 Setup-Hinweise
Installation von pyenv unter Ubuntu 16.04