python smbus IOError: [Errno 2] No such file or directory

1.打开配置文件

sudo nano /boot/config.txt

打开以下选项

"dtparam=i2c_arm=on"

ctrl + o 保存

ctrl + x 退出

2.刷新配置文件

sudo raspi-config

3.打开 I2c选项

4.重启

5.再次运行

参考:

https://www.raspberrypi.org/forums/viewtopic.php?t=100189

原文地址:https://www.cnblogs.com/sea-stream/p/11111827.html