The solution of no module named ‘jinja2. Asyncsupport’

Background of the problem

When compiling Px4,

make px4_sitl_default gazebo

An error has been reported,

[0/535] Performing build step for 'sitl_gazebo'
[1/9] Generating /home/zth/catkin_ws/Firmware/Tools/sitl_gazebo/models/mb1240-xl-ez4/mb1240-xl-ez4-gen.sdf
FAILED: /home/zth/catkin_ws/Firmware/Tools/sitl_gazebo/models/mb1240-xl-ez4/mb1240-xl-ez4-gen.sdf 
cd /home/zth/catkin_ws/Firmware/build/px4_sitl_default/build_gazebo && /usr/bin/python3 /home/zth/catkin_ws/Firmware/Tools/sitl_gazebo/scripts/jinja_gen.py /home/zth/catkin_ws/Firmware/Tools/sitl_gazebo/models/mb1240-xl-ez4/mb1240-xl-ez4.sdf.jinja /home/zth/catkin_ws/Firmware/Tools/sitl_gazebo
Traceback (most recent call last):
  File "/home/zth/catkin_ws/Firmware/Tools/sitl_gazebo/scripts/jinja_gen.py", line 4, in <module>
    import jinja2
  File "/usr/lib/python2.7/dist-packages/jinja2/__init__.py", line 82, in <module>
    _patch_async()
  File "/usr/lib/python2.7/dist-packages/jinja2/__init__.py", line 78, in _patch_async
    from jinja2.asyncsupport import patch_all
ModuleNotFoundError: No module named 'jinja2.asyncsupport'
[2/9] Generating /home/zth/catkin_ws/Firmware/Tools/sitl_gazebo/models/pixhawk/pixhawk-gen.sdf
FAILED: /home/zth/catkin_ws/Firmware/Tools/sitl_gazebo/models/pixhawk/pixhawk-gen.sdf 
cd /home/zth/catkin_ws/Firmware/build/px4_sitl_default/build_gazebo && /usr/bin/python3 /home/zth/catkin_ws/Firmware/Tools/sitl_gazebo/scripts/jinja_gen.py /home/zth/catkin_ws/Firmware/Tools/sitl_gazebo/models/pixhawk/pixhawk.sdf.jinja /home/zth/catkin_ws/Firmware/Tools/sitl_gazebo
Traceback (most recent call last):
  File "/home/zth/catkin_ws/Firmware/Tools/sitl_gazebo/scripts/jinja_gen.py", line 4, in <module>
    import jinja2
  File "/usr/lib/python2.7/dist-packages/jinja2/__init__.py", line 82, in <module>
    _patch_async()
  File "/usr/lib/python2.7/dist-packages/jinja2/__init__.py", line 78, in _patch_async
    from jinja2.asyncsupport import patch_all
ModuleNotFoundError: No module named 'jinja2.asyncsupport'
[3/9] Generating /home/zth/catkin_ws/Firmware/Tools/sitl_gazebo/models/matrice_100/matrice_100-gen.sdf
FAILED: /home/zth/catkin_ws/Firmware/Tools/sitl_gazebo/models/matrice_100/matrice_100-gen.sdf 
cd /home/zth/catkin_ws/Firmware/build/px4_sitl_default/build_gazebo && /usr/bin/python3 /home/zth/catkin_ws/Firmware/Tools/sitl_gazebo/scripts/jinja_gen.py /home/zth/catkin_ws/Firmware/Tools/sitl_gazebo/models/matrice_100/matrice_100.sdf.jinja /home/zth/catkin_ws/Firmware/Tools/sitl_gazebo
Traceback (most recent call last):
  File "/home/zth/catkin_ws/Firmware/Tools/sitl_gazebo/scripts/jinja_gen.py", line 4, in <module>
    import jinja2
  File "/usr/lib/python2.7/dist-packages/jinja2/__init__.py", line 82, in <module>
    _patch_async()
  File "/usr/lib/python2.7/dist-packages/jinja2/__init__.py", line 78, in _patch_async
    from jinja2.asyncsupport import patch_all
ModuleNotFoundError: No module named 'jinja2.asyncsupport'
[4/9] Generating /home/zth/catkin_ws/Firmware/Tools/sitl_gazebo/models/r200/r200-gen.sdf
FAILED: /home/zth/catkin_ws/Firmware/Tools/sitl_gazebo/models/r200/r200-gen.sdf 
cd /home/zth/catkin_ws/Firmware/build/px4_sitl_default/build_gazebo && /usr/bin/python3 /home/zth/catkin_ws/Firmware/Tools/sitl_gazebo/scripts/jinja_gen.py /home/zth/catkin_ws/Firmware/Tools/sitl_gazebo/models/r200/r200.sdf.jinja /home/zth/catkin_ws/Firmware/Tools/sitl_gazebo
Traceback (most recent call last):
  File "/home/zth/catkin_ws/Firmware/Tools/sitl_gazebo/scripts/jinja_gen.py", line 4, in <module>
    import jinja2
  File "/usr/lib/python2.7/dist-packages/jinja2/__init__.py", line 82, in <module>
    _patch_async()
  File "/usr/lib/python2.7/dist-packages/jinja2/__init__.py", line 78, in _patch_async
    from jinja2.asyncsupport import patch_all
ModuleNotFoundError: No module named 'jinja2.asyncsupport'
[5/9] Generating /home/zth/catkin_ws/Firmware/Tools/sitl_gazebo/models/c920/c920-gen.sdf
FAILED: /home/zth/catkin_ws/Firmware/Tools/sitl_gazebo/models/c920/c920-gen.sdf 
cd /home/zth/catkin_ws/Firmware/build/px4_sitl_default/build_gazebo && /usr/bin/python3 /home/zth/catkin_ws/Firmware/Tools/sitl_gazebo/scripts/jinja_gen.py /home/zth/catkin_ws/Firmware/Tools/sitl_gazebo/models/c920/c920.sdf.jinja /home/zth/catkin_ws/Firmware/Tools/sitl_gazebo
Traceback (most recent call last):
  File "/home/zth/catkin_ws/Firmware/Tools/sitl_gazebo/scripts/jinja_gen.py", line 4, in <module>
    import jinja2
  File "/usr/lib/python2.7/dist-packages/jinja2/__init__.py", line 82, in <module>
    _patch_async()
  File "/usr/lib/python2.7/dist-packages/jinja2/__init__.py", line 78, in _patch_async
    from jinja2.asyncsupport import patch_all
ModuleNotFoundError: No module named 'jinja2.asyncsupport'
[6/9] Generating /home/zth/catkin_ws/Firmware/Tools/sitl_gazebo/models/px4flow/px4flow-gen.sdf
FAILED: /home/zth/catkin_ws/Firmware/Tools/sitl_gazebo/models/px4flow/px4flow-gen.sdf 
cd /home/zth/catkin_ws/Firmware/build/px4_sitl_default/build_gazebo && /usr/bin/python3 /home/zth/catkin_ws/Firmware/Tools/sitl_gazebo/scripts/jinja_gen.py /home/zth/catkin_ws/Firmware/Tools/sitl_gazebo/models/px4flow/px4flow.sdf.jinja /home/zth/catkin_ws/Firmware/Tools/sitl_gazebo
Traceback (most recent call last):
  File "/home/zth/catkin_ws/Firmware/Tools/sitl_gazebo/scripts/jinja_gen.py", line 4, in <module>
    import jinja2
  File "/usr/lib/python2.7/dist-packages/jinja2/__init__.py", line 82, in <module>
    _patch_async()
  File "/usr/lib/python2.7/dist-packages/jinja2/__init__.py", line 78, in _patch_async
    from jinja2.asyncsupport import patch_all
ModuleNotFoundError: No module named 'jinja2.asyncsupport'
[7/9] Generating /home/zth/catkin_ws/Firmware/Tools/sitl_gazebo/models/3DR_gps_mag/3DR_gps_mag-gen.sdf
FAILED: /home/zth/catkin_ws/Firmware/Tools/sitl_gazebo/models/3DR_gps_mag/3DR_gps_mag-gen.sdf 
cd /home/zth/catkin_ws/Firmware/build/px4_sitl_default/build_gazebo && /usr/bin/python3 /home/zth/catkin_ws/Firmware/Tools/sitl_gazebo/scripts/jinja_gen.py /home/zth/catkin_ws/Firmware/Tools/sitl_gazebo/models/3DR_gps_mag/3DR_gps_mag.sdf.jinja /home/zth/catkin_ws/Firmware/Tools/sitl_gazebo
Traceback (most recent call last):
  File "/home/zth/catkin_ws/Firmware/Tools/sitl_gazebo/scripts/jinja_gen.py", line 4, in <module>
    import jinja2
  File "/usr/lib/python2.7/dist-packages/jinja2/__init__.py", line 82, in <module>
    _patch_async()
  File "/usr/lib/python2.7/dist-packages/jinja2/__init__.py", line 78, in _patch_async
    from jinja2.asyncsupport import patch_all
ModuleNotFoundError: No module named 'jinja2.asyncsupport'
[8/9] Generating /home/zth/catkin_ws/Firmware/Tools/sitl_gazebo/models/sf10a/sf10a-gen.sdf
FAILED: /home/zth/catkin_ws/Firmware/Tools/sitl_gazebo/models/sf10a/sf10a-gen.sdf 
cd /home/zth/catkin_ws/Firmware/build/px4_sitl_default/build_gazebo && /usr/bin/python3 /home/zth/catkin_ws/Firmware/Tools/sitl_gazebo/scripts/jinja_gen.py /home/zth/catkin_ws/Firmware/Tools/sitl_gazebo/models/sf10a/sf10a.sdf.jinja /home/zth/catkin_ws/Firmware/Tools/sitl_gazebo
Traceback (most recent call last):
  File "/home/zth/catkin_ws/Firmware/Tools/sitl_gazebo/scripts/jinja_gen.py", line 4, in <module>
    import jinja2
  File "/usr/lib/python2.7/dist-packages/jinja2/__init__.py", line 82, in <module>
    _patch_async()
  File "/usr/lib/python2.7/dist-packages/jinja2/__init__.py", line 78, in _patch_async
    from jinja2.asyncsupport import patch_all
ModuleNotFoundError: No module named 'jinja2.asyncsupport'
[9/9] Generating /home/zth/catkin_ws/Firmware/Tools/sitl_gazebo/models/iris/iris.sdf
FAILED: /home/zth/catkin_ws/Firmware/Tools/sitl_gazebo/models/iris/iris.sdf 
cd /home/zth/catkin_ws/Firmware/Tools/sitl_gazebo && rm -f /home/zth/catkin_ws/Firmware/Tools/sitl_gazebo/models/iris/iris.sdf && /usr/bin/python3 /home/zth/catkin_ws/Firmware/Tools/sitl_gazebo/scripts/xacro.py -o /home/zth/catkin_ws/Firmware/Tools/sitl_gazebo/models/rotors_description/urdf/iris_base.urdf /home/zth/catkin_ws/Firmware/Tools/sitl_gazebo/models/rotors_description/urdf/iris_base.xacro enable_mavlink_interface:=true enable_ground_truth:=false enable_wind:=false enable_logging:=false rotors_description_dir:=/home/zth/catkin_ws/Firmware/Tools/sitl_gazebo/models/rotors_description send_vision_estimation:=true send_odometry:=false && gz sdf -p /home/zth/catkin_ws/Firmware/Tools/sitl_gazebo/models/rotors_description/urdf/iris_base.urdf >> /home/zth/catkin_ws/Firmware/Tools/sitl_gazebo/models/iris/iris.sdf && rm -f /home/zth/catkin_ws/Firmware/Tools/sitl_gazebo/models/rotors_description/urdf/iris_base.urdf

gz: symbol lookup error: /usr/lib/x86_64-linux-gnu/libgazebo_common.so.9: undefined symbol: _ZN8ignition10fuel_tools12ClientConfig12SetUserAgentERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEE
ninja: build stopped: subcommand failed.
[2/535] Generating mixer_multirotor.generated.h
FAILED: src/lib/mixer/MultirotorMixer/mixer_multirotor.generated.h 
cd /home/zth/catkin_ws/Firmware/build/px4_sitl_default/src/lib/mixer/MultirotorMixer && /usr/bin/python3 /home/zth/catkin_ws/Firmware/src/lib/mixer/MultirotorMixer/geometries/tools/px_generate_mixers.py -f /home/zth/catkin_ws/Firmware/src/lib/mixer/MultirotorMixer/geometries/dodeca_bottom_cox.toml /home/zth/catkin_ws/Firmware/src/lib/mixer/MultirotorMixer/geometries/dodeca_top_cox.toml /home/zth/catkin_ws/Firmware/src/lib/mixer/MultirotorMixer/geometries/hex_cox.toml /home/zth/catkin_ws/Firmware/src/lib/mixer/MultirotorMixer/geometries/hex_plus.toml /home/zth/catkin_ws/Firmware/src/lib/mixer/MultirotorMixer/geometries/hex_t.toml /home/zth/catkin_ws/Firmware/src/lib/mixer/MultirotorMixer/geometries/hex_x.toml /home/zth/catkin_ws/Firmware/src/lib/mixer/MultirotorMixer/geometries/octa_cox.toml /home/zth/catkin_ws/Firmware/src/lib/mixer/MultirotorMixer/geometries/octa_cox_wide.toml /home/zth/catkin_ws/Firmware/src/lib/mixer/MultirotorMixer/geometries/octa_plus.toml /home/zth/catkin_ws/Firmware/src/lib/mixer/MultirotorMixer/geometries/octa_x.toml /home/zth/catkin_ws/Firmware/src/lib/mixer/MultirotorMixer/geometries/quad_deadcat.toml /home/zth/catkin_ws/Firmware/src/lib/mixer/MultirotorMixer/geometries/quad_h.toml /home/zth/catkin_ws/Firmware/src/lib/mixer/MultirotorMixer/geometries/quad_plus.toml /home/zth/catkin_ws/Firmware/src/lib/mixer/MultirotorMixer/geometries/quad_s250aq.toml /home/zth/catkin_ws/Firmware/src/lib/mixer/MultirotorMixer/geometries/quad_vtail.toml /home/zth/catkin_ws/Firmware/src/lib/mixer/MultirotorMixer/geometries/quad_wide.toml /home/zth/catkin_ws/Firmware/src/lib/mixer/MultirotorMixer/geometries/quad_x_cw.toml /home/zth/catkin_ws/Firmware/src/lib/mixer/MultirotorMixer/geometries/quad_x.toml /home/zth/catkin_ws/Firmware/src/lib/mixer/MultirotorMixer/geometries/quad_x_pusher.toml /home/zth/catkin_ws/Firmware/src/lib/mixer/MultirotorMixer/geometries/quad_y.toml /home/zth/catkin_ws/Firmware/src/lib/mixer/MultirotorMixer/geometries/tri_y.toml /home/zth/catkin_ws/Firmware/src/lib/mixer/MultirotorMixer/geometries/twin_engine.toml -o mixer_multirotor.generated.h
Failed to import numpy: 
Importing the multiarray numpy extension module failed.  Most
likely you are trying to import a failed build of numpy.
If you're working with a numpy git repo, try `git clean -xdf` (removes all
files not under version control).  Otherwise reinstall numpy.

Original error was: cannot import name 'multiarray'


You may need to install it using:
    pip3 install --user numpy

[3/535] Generating mixer_multirotor_normalized.generated.h
FAILED: src/lib/mixer/MultirotorMixer/mixer_multirotor_normalized.generated.h 
cd /home/zth/catkin_ws/Firmware/build/px4_sitl_default/src/lib/mixer/MultirotorMixer && /usr/bin/python3 /home/zth/catkin_ws/Firmware/src/lib/mixer/MultirotorMixer/geometries/tools/px_generate_mixers.py --normalize -f /home/zth/catkin_ws/Firmware/src/lib/mixer/MultirotorMixer/geometries/dodeca_bottom_cox.toml /home/zth/catkin_ws/Firmware/src/lib/mixer/MultirotorMixer/geometries/dodeca_top_cox.toml /home/zth/catkin_ws/Firmware/src/lib/mixer/MultirotorMixer/geometries/hex_cox.toml /home/zth/catkin_ws/Firmware/src/lib/mixer/MultirotorMixer/geometries/hex_plus.toml /home/zth/catkin_ws/Firmware/src/lib/mixer/MultirotorMixer/geometries/hex_t.toml /home/zth/catkin_ws/Firmware/src/lib/mixer/MultirotorMixer/geometries/hex_x.toml /home/zth/catkin_ws/Firmware/src/lib/mixer/MultirotorMixer/geometries/octa_cox.toml /home/zth/catkin_ws/Firmware/src/lib/mixer/MultirotorMixer/geometries/octa_cox_wide.toml /home/zth/catkin_ws/Firmware/src/lib/mixer/MultirotorMixer/geometries/octa_plus.toml /home/zth/catkin_ws/Firmware/src/lib/mixer/MultirotorMixer/geometries/octa_x.toml /home/zth/catkin_ws/Firmware/src/lib/mixer/MultirotorMixer/geometries/quad_deadcat.toml /home/zth/catkin_ws/Firmware/src/lib/mixer/MultirotorMixer/geometries/quad_h.toml /home/zth/catkin_ws/Firmware/src/lib/mixer/MultirotorMixer/geometries/quad_plus.toml /home/zth/catkin_ws/Firmware/src/lib/mixer/MultirotorMixer/geometries/quad_s250aq.toml /home/zth/catkin_ws/Firmware/src/lib/mixer/MultirotorMixer/geometries/quad_vtail.toml /home/zth/catkin_ws/Firmware/src/lib/mixer/MultirotorMixer/geometries/quad_wide.toml /home/zth/catkin_ws/Firmware/src/lib/mixer/MultirotorMixer/geometries/quad_x_cw.toml /home/zth/catkin_ws/Firmware/src/lib/mixer/MultirotorMixer/geometries/quad_x.toml /home/zth/catkin_ws/Firmware/src/lib/mixer/MultirotorMixer/geometries/quad_x_pusher.toml /home/zth/catkin_ws/Firmware/src/lib/mixer/MultirotorMixer/geometries/quad_y.toml /home/zth/catkin_ws/Firmware/src/lib/mixer/MultirotorMixer/geometries/tri_y.toml /home/zth/catkin_ws/Firmware/src/lib/mixer/MultirotorMixer/geometries/twin_engine.toml -o mixer_multirotor_normalized.generated.h
Failed to import numpy: 
Importing the multiarray numpy extension module failed.  Most
likely you are trying to import a failed build of numpy.
If you're working with a numpy git repo, try `git clean -xdf` (removes all
files not under version control).  Otherwise reinstall numpy.

Original error was: cannot import name 'multiarray'


You may need to install it using:
    pip3 install --user numpy

[4/535] Generating mixer_multirotor_6dof.generated.h
FAILED: src/lib/mixer/MultirotorMixer/mixer_multirotor_6dof.generated.h 
cd /home/zth/catkin_ws/Firmware/build/px4_sitl_default/src/lib/mixer/MultirotorMixer && /usr/bin/python3 /home/zth/catkin_ws/Firmware/src/lib/mixer/MultirotorMixer/geometries/tools/px_generate_mixers.py --sixdof -f /home/zth/catkin_ws/Firmware/src/lib/mixer/MultirotorMixer/geometries/dodeca_bottom_cox.toml /home/zth/catkin_ws/Firmware/src/lib/mixer/MultirotorMixer/geometries/dodeca_top_cox.toml /home/zth/catkin_ws/Firmware/src/lib/mixer/MultirotorMixer/geometries/hex_cox.toml /home/zth/catkin_ws/Firmware/src/lib/mixer/MultirotorMixer/geometries/hex_plus.toml /home/zth/catkin_ws/Firmware/src/lib/mixer/MultirotorMixer/geometries/hex_t.toml /home/zth/catkin_ws/Firmware/src/lib/mixer/MultirotorMixer/geometries/hex_x.toml /home/zth/catkin_ws/Firmware/src/lib/mixer/MultirotorMixer/geometries/octa_cox.toml /home/zth/catkin_ws/Firmware/src/lib/mixer/MultirotorMixer/geometries/octa_cox_wide.toml /home/zth/catkin_ws/Firmware/src/lib/mixer/MultirotorMixer/geometries/octa_plus.toml /home/zth/catkin_ws/Firmware/src/lib/mixer/MultirotorMixer/geometries/octa_x.toml /home/zth/catkin_ws/Firmware/src/lib/mixer/MultirotorMixer/geometries/quad_deadcat.toml /home/zth/catkin_ws/Firmware/src/lib/mixer/MultirotorMixer/geometries/quad_h.toml /home/zth/catkin_ws/Firmware/src/lib/mixer/MultirotorMixer/geometries/quad_plus.toml /home/zth/catkin_ws/Firmware/src/lib/mixer/MultirotorMixer/geometries/quad_s250aq.toml /home/zth/catkin_ws/Firmware/src/lib/mixer/MultirotorMixer/geometries/quad_vtail.toml /home/zth/catkin_ws/Firmware/src/lib/mixer/MultirotorMixer/geometries/quad_wide.toml /home/zth/catkin_ws/Firmware/src/lib/mixer/MultirotorMixer/geometries/quad_x_cw.toml /home/zth/catkin_ws/Firmware/src/lib/mixer/MultirotorMixer/geometries/quad_x.toml /home/zth/catkin_ws/Firmware/src/lib/mixer/MultirotorMixer/geometries/quad_x_pusher.toml /home/zth/catkin_ws/Firmware/src/lib/mixer/MultirotorMixer/geometries/quad_y.toml /home/zth/catkin_ws/Firmware/src/lib/mixer/MultirotorMixer/geometries/tri_y.toml /home/zth/catkin_ws/Firmware/src/lib/mixer/MultirotorMixer/geometries/twin_engine.toml -o mixer_multirotor_6dof.generated.h
Failed to import numpy: 
Importing the multiarray numpy extension module failed.  Most
likely you are trying to import a failed build of numpy.
If you're working with a numpy git repo, try `git clean -xdf` (removes all
files not under version control).  Otherwise reinstall numpy.

Original error was: cannot import name 'multiarray'


You may need to install it using:
    pip3 install --user numpy

[5/535] Generating serial_params.c
FAILED: generated_params/serial_params.c 
cd /home/zth/catkin_ws/Firmware/build/px4_sitl_default/src/lib/parameters && /usr/bin/cmake -E make_directory /home/zth/catkin_ws/Firmware/build/px4_sitl_default/generated_params && /usr/bin/python3 /home/zth/catkin_ws/Firmware/Tools/serial/generate_config.py --params-file /home/zth/catkin_ws/Firmware/build/px4_sitl_default/generated_params/serial_params.c --serial-ports --config-files /home/zth/catkin_ws/Firmware/src/lib/battery/module.yaml /home/zth/catkin_ws/Firmware/src/drivers/gps/module.yaml /home/zth/catkin_ws/Firmware/src/modules/mavlink/module.yaml
Failed to import jinja2: No module named 'jinja2.asyncsupport'

You may need to install it using:
    pip3 install --user jinja2

FAILED: external/Stamp/sitl_gazebo/sitl_gazebo-build 
cd /home/zth/catkin_ws/Firmware/build/px4_sitl_default/build_gazebo && /usr/bin/cmake --build .
ninja: build stopped: subcommand failed.
Makefile:198: recipe for target 'px4_sitl_default' failed
make: *** [px4_sitl_default] Error 1

The first mistake is:

ModuleNotFoundError: No module named 'jinja2.asyncsupport'

Solution process:

1. Install jinja2 according to the command given in the error prompt:

zth@SugoAsurada:~/catkin_ws/Firmware$ pip install jinja2
Collecting jinja2
  Using cached https://files.pythonhosted.org/packages/30/9e/f663a2aa66a09d838042ae1a2c5659828bb9b41ea3a6efa20a20fd92b121/Jinja2-2.11.2-py2.py3-none-any.whl
Collecting MarkupSafe>=0.23 (from jinja2)
  Downloading https://files.pythonhosted.org/packages/fb/40/f3adb7cf24a8012813c5edb20329eb22d5d8e2a0ecf73d21d6b85865da11/MarkupSafe-1.1.1-cp27-cp27mu-manylinux1_x86_64.whl
Installing collected packages: MarkupSafe, jinja2
Successfully installed MarkupSafe-1.1.1 jinja2-2.11.2

The version of jinja2 installed with this command is 2.11.2.
In ~ / catkin_ View the version of jinja2 under the directory WS / firmware,

zth@SugoAsurada:~/catkin_ws/Firmware$ python
Python 2.7.17 (default, Sep 30 2020, 13:38:04) 
[GCC 7.5.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import jinja2
>>> jinja2.__version__
'2.10'
>>> exit()

The resulting version is 2.10.
Obviously, jinja2 was not installed in the path we needed.

2. Check the location of jinja2 in the current path, and find the cause of the problem

zth@SugoAsurada:~/catkin_ws/Firmware$ python
Python 2.7.17 (default, Sep 30 2020, 13:38:04) 
[GCC 7.5.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import jinja2
>>> jinja2.__file__
'/usr/lib/python2.7/dist-packages/jinja2/__init__.pyc'
>>> exit()

After coming to the directory ‘/ usr / lib / python2.7/dist-packages/jinja2’, I found that there are no files in the directory asyncsupport.py . The PY file is missing from the official website.

3. Delete jinja2 from the specified directory and install a new jinja2

Unload command:

sudo  rm -r /usr/lib/python2.7/dist-packages/jinja2

Output results:

zth@SugoAsurada:~/catkin_ws/Firmware$ sudo  rm -r /usr/lib/python2.7/dist-packages/jinja2
zth@SugoAsurada:~/catkin_ws/Firmware$ python
Python 2.7.17 (default, Sep 30 2020, 13:38:04) 
[GCC 7.5.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import jinja2
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named jinja2
>>> exit()

Installation command:

sudo pip install jinja2 --target=/usr/lib/python2.7/dist-packages

Inspection output:

zth@SugoAsurada:~/catkin_ws/Firmware$ python
Python 2.7.17 (default, Sep 30 2020, 13:38:04) 
[GCC 7.5.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import jinja2
>>> jinja2.__file__
'/usr/lib/python2.7/dist-packages/jinja2/__init__.pyc'
>>> jinja2.__version__
'2.11.2'
>>> exit()

Read More: