错误现象:

Traceback (most recent call last):
  File "/home/pi/ble-uart-peripheral/uart_peripheral.py", line 16, in <module>
    import yaml
ModuleNotFoundError: No module named 'yaml'

一般来说,命令行使用以下命令就能解决问题:

pip install yaml

但是,很遗憾,结果提示如下:

pi@pi:~/HeatMap $ pip install yaml
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Collecting yaml
  Could not find a version that satisfies the requirement yaml (from versions: )
No matching distribution found for yaml

其实正确的命令行内容应该是如下所示:

pip install pyyaml

结果显示成功

pi@pi:~/HeatMap $ pip install pyyaml
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Collecting pyyaml
  Downloading https://files.pythonhosted.org/packages/a0/a4/d63f2d7597e1a4b55aa3b4d6c5b029991d3b824b5bd331af8d4ab1ed687d/PyYAML-5.4.1.tar.gz (175kB)
    100% |████████████████████████████████| 184kB 481kB/s 
  Installing build dependencies ... done
Building wheels for collected packages: pyyaml
  Running setup.py bdist_wheel for pyyaml ... done
  Stored in directory: /home/pi/.cache/pip/wheels/2a/d4/92/cf299bdf4162957ca8126b46e913e29f76a4f17ca762c45028
Successfully built pyyaml
Installing collected packages: pyyaml
Successfully installed pyyaml-5.4.1
pi@pi:~/HeatMap $ 

Logo

AtomGit 是由开放原子开源基金会联合 CSDN 等生态伙伴共同推出的新一代开源与人工智能协作平台。平台坚持“开放、中立、公益”的理念,把代码托管、模型共享、数据集托管、智能体开发体验和算力服务整合在一起,为开发者提供从开发、训练到部署的一站式体验。

更多推荐