No module named 'yaml' solution

Error phenomenon:

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'

Generally speaking, using the following commands on the command line will solve the problem:

pip install yaml

However, unfortunately, the result prompt is as follows:

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

In fact, the correct command line content should be as follows:

pip install pyyaml

The result shows success

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 $ 

Guess you like

Origin blog.csdn.net/jndingxin/article/details/125809878