title: Trouble with step in setting up virtualenvwrapper for Python
body: <p>I'm trying to complete the section <strong>Managing Virtual Environments With virtualenvwrapper</strong> <a href="https://realpython.com/python-virtual-environments-a-primer/" rel="nofollow noreferrer">here</a>.</p>
  <p>I'm up to this section:</p>
  <blockquote>
  <p>Once it’s installed, we’ll need to activate its shell functions. We can do this by running source on the installed virtualenvwrapper.sh script. When you first install it with pip, the output of the installation will tell you the exact location of virtualenvwrapper.sh. Or you can simply run the following:</p>
  <p><code>$ which virtualenvwrapper.sh</code></p>
  <p><code>/usr/local/bin/virtualenvwrapper.sh</code></p>
  <p>Using that path, add the following three lines to your shell’s startup file. If you’re using the Bash shell, you would place these lines in either the <code>~/.bashrc</code> file or the <code>~/.profile</code> file. For other shells, like zsh, csh, or fish, you would need to use the startup files specific to that shell. All that matters is that these commands are executed when you log in or open a new shell:</p>
  <p><code>export WORKON_HOME=$HOME/.virtualenvs   # Optional</code></p>
  <p><code>export PROJECT_HOME=$HOME/projects      # Optional</code></p>
  <p><code>source /usr/local/bin/virtualenvwrapper.sh</code></p>
  </blockquote>
  <p>When using <code>which virtualenvwrapper.sh</code>, I got the following result:</p>
  <p><code>/usr/local/bin/virtualenvwrapper.sh</code></p>
  <p>Then I use <code>export WORKON_HOME=$HOME/.virtualenvs</code> and <code>export PROJECT_HOME=$HOME/projects</code> with no output, implying success.</p>
  <p>And finally, I use <code>source /usr/local/bin/virtualenvwrapper.sh</code> and get the following result:</p>
  <p><code>/System/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python: No module named virtualenvwrapper virtualenvwrapper.sh: There was a problem running the initialization hooks.</code></p>
  <p><code>If Python could not import the module virtualenvwrapper.hook_loader, check that virtualenvwrapper has been installed for VIRTUALENVWRAPPER_PYTHON=/usr/bin/python and that PATH is set properly.</code></p>
  <p>I'm not sure precisely what is wrong here, but it should be using Python 3 instead of Python 2:</p>
  <p><code>python --version</code> results in <code>Python 2.7.16</code></p>
  <p><code>python3 --version</code> results in <code>Python 3.7.6</code></p>
  <p>My OS is macOS, and my shell is zsh.</p>
  <hr />
  <h2>Edit</h2>
  <p>As suggested in the comments, I followed the <strong>Using Django inside a Python virtual environment</strong> section <a href="https://developer.mozilla.org/en-US/docs/Learn/Server-side/Django/development_environment" rel="nofollow noreferrer">here</a>.</p>
  <p>This works fine:</p>
  <p><code>export WORKON_HOME=$HOME/.virtualenvs</code></p>
  <p><code>export VIRTUALENVWRAPPER_PYTHON=/usr/bin/python3</code></p>
  <p><code>export PROJECT_HOME=$HOME/Devel</code></p>
  <p>However, <code>source /usr/local/bin/virtualenvwrapper.sh</code> results in</p>
  <p><code>/Library/Developer/CommandLineTools/usr/bin/python3: Error while finding module specification for 'virtualenvwrapper.hook_loader' (ModuleNotFoundError: No module named 'virtualenvwrapper') virtualenvwrapper.sh: There was a problem running the initialization hooks.</code></p>
  <p><code>If Python could not import the module virtualenvwrapper.hook_loader, check that virtualenvwrapper has been installed for VIRTUALENVWRAPPER_PYTHON=/usr/bin/python3 and that PATH is set properly.</code></p>