title: Python script in systemd: virtual environment or real environment
body: <p>I have been trying to run a python script on start-up (on a Pi). I initially did this via an .sh script triggered by cron. </p>
  
  <p>Posting with a problem on StackExchange Pi (<a href="https://raspberrypi.stackexchange.com/questions/110868/parts-of-code-not-running-when-autostarting-script-in-crontab">https://raspberrypi.stackexchange.com/questions/110868/parts-of-code-not-running-when-autostarting-script-in-crontab</a>) the suggestion is to use systemd. </p>
  
  <p>The person helping me there has suggested not using a virtual environment when executing the Python script (they note their limited familiarity with Python), and using the real environment instead. But other resources strongly suggest the use of a virtual environment (e.g. <a href="https://docs.python.org/3/tutorial/venv.html" rel="nofollow noreferrer">https://docs.python.org/3/tutorial/venv.html</a>). </p>
  
  <p>In the hope of setting this up correctly could anyone weigh in on the correct approach?</p>