# Get the current environment end filter out the old
# PYTHONPATH variable if exists in the environment
env = [env for env in QtCore.QProcess.systemEnvironment()
if not env.startswith('PYTHONPATH=')]
# Add your PYTHONPATH
env.append('PYTHONPATH=path_to_where_you_want')
# Create a process, set the environment and run the script
p = QtCore.QProcess()
p.setEnvironment(env)
p.start('perl abc.pl')
If you want the subprocess python to just revert to it's default PYTHONPATH
just remove the current one from environment (skip the env.append
part)