Python 没有看到机器包

Python doesn't see machine package

我正在 rpi 0 w 上开发一个项目,想查看 MPU6050 传感器的一些 GitHub 代码 (https://github.com/adamjezek98/MPU6050-ESP8266-MicroPython)。需要一个机器库。但是,当我安装它时,Python (3.7) 看不到它。

(venv) pi@raspberrypi:~/Software $ pip freeze | grep machine
machine==0.0.1


(venv) pi@raspberrypi:~/Software $ python
Python 3.7.3 (default, Jul 25 2020, 13:03:44) 
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from machine import I2C, Pin
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'machine'
>>> 

我不知道发生了什么。就我而言,我安装了正确的包:

(venv) pi@raspberrypi:~ $ pip install machine
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Collecting machine
  Using cached machine-0.0.1-py2.py3-none-any.whl (4.2 kB)
Collecting pycrypto
  Downloading https://www.piwheels.org/simple/pycrypto/pycrypto-2.6.1-cp37-cp37m-linux_armv6l.whl (525 kB)
     |████████████████████████████████| 525 kB 309 kB/s 
Installing collected packages: pycrypto, machine
Successfully installed machine-0.0.1 pycrypto-2.6.1

您正在安装错误的包。您代码段中的 machine 模块来自 micropython-machinepip install micropython-machine.