1. Install
Source: https://sumo.dlr.de/docs/Downloads.html
sudo add-apt-repository ppa:sumo/stable
sudo apt-get update
sudo apt-get install sumo sumo-tools sumo-doc
Adding Environment Variables
gedit ~/.bashrc
After the text added:
exprot SUMO_HOME= '/usr/share/sumo/tools'
2. python code before introduction traci, add the following code:
import sys,os,subprocess
sys.path.append('/usr/share/sumo/tools') #import traci,sumolib
sumoBinary = "/usr/bin/sumo" #sumo or sumo-gui connection
import traci