If the error as below occurs,
$ ../Tools/autotest/sim_vehicle.py --map --console
Traceback (most recent call last):
File "../Tools/autotest/sim_vehicle.py", line 31, in <module>
from pymavlink import mavextra
ModuleNotFoundError: No module named 'pymavlink'
You can uninstall the existing gym and then should install it.
This error appears to be a version problem of gym.
$ python -m pip install pymavlink
Next,
cd ~/ardupilot/Tools/autotest
$ python sim_vehicle.py --map --console
$ python sim_vehicle.py -v ArduCopter --map --console