title: Using earlier version of python with poetry
body: <p>What is the process for setting up a project and using an earlier version of Python which has not been installed as a system-wide binary?</p>
  <p>Ideally, <code>poetry add &lt;package&gt;</code> should install to that previous version of python, and <code>poetry shell</code> should open up a virtual environment with the correct version.</p>
  <p>I have tried:</p>
  <pre class="lang-sh prettyprint-override"><code>mkdir myproj
  cd myproj
  
  eval &quot;$(pyenv init -)&quot;
  pyenv install 3.8.9
  pyenv local 3.8.9
  
  poetry init --no-interaction --python=&quot;3.8.9&quot;
  poetry env use 3.8.9
  poetry add numpy
  
  echo '
  import sys
  print(sys.version)
  
  import numpy
  print(numpy.__version__)
  ' &gt; main.py
  
  poetry shell
  eval &quot;$(pyenv init -)&quot;
  python main.py
  </code></pre>
  <p>But this gives:</p>
  <pre class="lang-py prettyprint-override"><code>3.8.9 (default, May  1 2021, 22:43:00)
  [GCC 10.2.0]
  Traceback (most recent call last):
    File &quot;main.py&quot;, line 5, in &lt;module&gt;
      import numpy
  ModuleNotFoundError: No module named 'numpy'
  </code></pre>
  <p>...indicating that the correct version of <code>python</code> ran (as expected), but that the package was not installed to python 3.8.9. Indeed:</p>
  <pre class="lang-sh prettyprint-override"><code>λ ls &quot;$(poetry env info --path)/lib&quot;
  python3.9
  
  λ grep &quot;version_info&quot; &quot;$(poetry env info --path)/pyvenv.cfg&quot;
  version_info = 3.9.4.final.0
  </code></pre>