An environment variable for a specific ROS package can be set in the package’s launch file. Simply add the <env> tag within the <launch> tags.

#file: package_1_launch_file.luanch
<launch>
    <env name="KEY" value="10" />
    <node pkg="package_1" type="main.py" name="ros_package_1" args="-v">
	</node>
</launch>