title: opening venv with crontab on python3 mac
body: <p>I am using oh-my-zsh, python 3.6.1 on a mac. I would like to run a crontab to execute a python3 script.</p>
  
  <p>One of my latest tries was this (none of the 20 different stackoverflow answers I found worked, so please don't shut this down as a duplicate:</p>
  
  <pre><code>SHELL=/bin/bash
  24 12 * * * root source env/latest-env/bin/activate &amp;&amp; /usr/local/bin/python3 /path/to/file/data_transfer.py
  </code></pre>
  
  <p>The error is <code>ModuleNotFoundError: No module named 'some_module'</code>, hence it is not activating my virtual_env, because that model exists in the latest virtual environment.
  I get the same error when using <code>#!env/latest-env/bin/python</code> at the top of my script and running it.</p>
  
  <p>I also tried the venv version instead:</p>
  
  <pre><code>activate_this = '/path/to/env/bin/activate_this.py'
  execfile(activate_this, dict(__file__=activate_this))
  </code></pre>
  
  <p>But this is for python 2, so the error is <code>NameError: name 'execfile' is not defined</code>, when I change it to exec, then I am getting <code>NameError: name 'env' is not defined</code>. But I know this is my path.</p>
  
  <p>How can I activate my latest venv in a crontab to get my script running?</p>