title: How can I activate a Python venv automatically when I ssh into a vagrant box?
body: <p>In a Vagrant VM running Ubuntu 16.04, I've created a Python 3 virtual environment using:</p>
  
  <pre><code>python3 -m venv /home/vagrant/venv
  </code></pre>
  
  <p>When I <code>vagrant ssh</code>, I can activate it using either:</p>
  
  <pre><code>source /home/vagrant/venv/bin/activate
  </code></pre>
  
  <p>or</p>
  
  <pre><code>. /home/vagrant/venv/bin/activate
  </code></pre>
  
  <p>During provisioning, I'm creating file <code>/etc/profile.d/login-bash.sh</code>:</p>
  
  <pre><code>cd /vagrant
  . /home/vagrant/venv/bin/activate
  </code></pre>
  
  <p>When I <code>ssh</code> in, that file is running because I'm starting in the <code>/vagrant</code> shared directory, but that second line doesn't appear to be doing anything.</p>