[PYTHON] Raspberry-pi memo

When I was asked to make various things, I wanted to touch it myself, so I started studying on holidays

Dig up what was bought and left for the time being Raspberry Pi4 ModelB Rev1.2 and Raspberry Pi Camera v2 Raspbian 10 buster


Maybe I'll get stuck with the same thing after a while, so record my steps

1. For the time being, connect the camera and save the image

Reference URL

http://igarashi-systems.com/sample/translation/raspberry-pi/usage/python-camera.html

IDE thonny? So move the copy of the sample program → Can be done without problems

2. I wanted to touch the image with openCV, so I installed it

Pip install python-opencv without thinking → Import cv2 cannot be done and hell begins


python defaults to python3

Reference URL

https://www.souichi.club/raspberrypi/python3-default/

$ sudo unlink python

$ sudo ln -s python3 python


 I was just sick of hitting python3 because I was touching the terminal to see if it could be imported properly. After all, I couldn't touch it with the terminal, so it might be meaningless.

---
### Something is wrong with the keyboard, so fix it
 Reference URL
> https://qiita.com/sukinasaki/items/426068d6e87169fa3d88

> ```
$ sudo raspi-config

From the same feeling

The name was different only at the beginning of config, but the fourth one is the same I wonder if it's not good to connect the keyboard with a USB switch, which sometimes returns to the original when I think I was able to set it. It returns to the original when switching the connection between the main PC and Raspberry Pi Addendum) I'm not sure, but did the original settings change to the Japanese layout? I deleted the English keyboard where the input methods are lined up and changed it to a Japanese keyboard, and it got better. Why was it made once in a while?


python3 + openCV

import cv2 cannot be used

Reference URL

https://creepfablic.site/2020/04/10/python-opencv-error/

Manage what seems to be related

ImportError: libjasper.so.1: cannot open shared object file: No such file or directory

$ sudo apt-get install libjasper-dev

ImportError: libQtGui.so.4: cannot open shared object file: No such file or directory

$ sudo apt-get install libqt4-test

ImportError: libcblas.so.3: cannot open shared object file: No such file or directory

$ sudo apt-get install libatlas-base-dev

ImportError: /lib/python3.7/site-packages/cv2/cv2.cpython-37m-arm-linux-gnueabihf.so: undefined symbol: __atomic_fetch_add_8

export LD_PRELOAD=/usr/lib/arm-linux-gnueabihf/libatomic.so.1

Added

I didn't know how to use the command (I just misunderstood the contents of the opened file as a lot of errors) I opened .bashrc in / home / pi with a text editor and copied and pasted the above sentence to the bottom line and saved it. I also put it in the .profile Which is the correct answer?


Here import cv2 passes in the terminal

Try adding import cv2 to the sample program of the IDE → ImportError appears again


I don't want to worry about the one that was included as standard, so switch to software that I have touched a little

Insert Visual Studio Code

Reference URL

https://qiita.com/optimisuke/items/1cd7440442f7420e6b99

It was easy to put in.

Import cv2 was OK normally, but import picamera stopped working

→ Did you get an error because you used the same picamera as the one that imports the name as the working folder of VS Code? There is such a relationship


The sample program works safely and the image can be saved. import cv2 also passes

Alright, start line

Recommended Posts

Raspberry-pi memo
gzip memo
Pandas memo
HackerRank memo
Python memo
python memo
graphene memo
Flask memo
pyenv memo
Matplotlib memo
pytest memo
sed memo
Python memo
Install Memo
BeautifulSoup4 memo
networkx memo
python memo
tomcat memo
command memo
Generator memo.
psycopg2 memo
Python memo
SSH memo
Command memo
Memo: rtl8812
pandas memo
Shell memo
Python memo
Pycharm memo
Python memo
AtCoder devotion memo (11/12)
[OpenCV] Personal memo
[Python] Memo dictionary
PyPI push memo
tensorflow-gpu introduction memo
LPIC201 learning memo
Jupyter Notebook memo
LPIC304 virtualization memo
ALDA execution memo
python beginner memo (9.2-10)
youtube download memo
Linux x memo
Django Learning Memo
ARC # 016 Participation memo
Beautiful Soup memo
LPIC101 study memo
python beginner memo (9.1)
linux (ubuntu) memo
scp command memo
Flask Primer Memo
celery / kombu memo
who command memo
django tutorial memo
Flask basic memo
Linux # Command Memo 1
★ Memo ★ Python Iroha
Gender recognition memo
Image reading memo
[MEMO] [TERMINAL] Alacritty
3D rotation memo (1)
[Python] EDA memo