Skip to content

Commit 411dc49

Browse files
committed
update docs
1 parent ee11f76 commit 411dc49

File tree

2 files changed

+24
-1
lines changed

2 files changed

+24
-1
lines changed

Diff for: docs/configuration.md

+8
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ virtualenvs.in-project = null
4848
virtualenvs.options.always-copy = true
4949
virtualenvs.options.system-site-packages = false
5050
virtualenvs.path = "{cache-dir}/virtualenvs" # /path/to/cache/directory/virtualenvs
51+
virtualenvs.prefer-shell-python = false
5152
```
5253

5354
## Displaying a single configuration setting
@@ -188,6 +189,13 @@ Give the virtual environment access to the system site-packages directory.
188189
Applies on virtualenv creation.
189190
Defaults to `false`.
190191

192+
### `virtualenvs.prefer-shell-python`
193+
194+
**Type**: boolean
195+
196+
Use currently activated Python version to create a new venv.
197+
Defaults to `false`, which means Python version used during Poetry installation is used.
198+
191199
### `repositories.<name>`
192200

193201
**Type**: string

Diff for: docs/managing-environments.md

+16-1
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,29 @@ To achieve this, it will first check if it's currently running inside a virtual
1818
If it is, it will use it directly without creating a new one. But if it's not, it will use
1919
one that it has already created or create a brand new one for you.
2020

21-
By default, Poetry will try to use the currently activated Python version
21+
By default, Poetry will try to use the Python version used during Poetry's installation
2222
to create the virtual environment for the current project.
2323

2424
However, for various reasons, this Python version might not be compatible
2525
with the `python` requirement of the project. In this case, Poetry will try
2626
to find one that is and use it. If it's unable to do so then you will be prompted
2727
to activate one explicitly, see [Switching environments](#switching-between-environments).
2828

29+
{{% note %}}
30+
To easily switch between Python versions, it is recommended to
31+
use [pyenv](https://github.com/pyenv/pyenv) or similar tools.
32+
33+
For instance, if your project requires a newer Python than is available with
34+
your system, a standard workflow would be:
35+
36+
```bash
37+
pyenv install 3.9.8
38+
pyenv local 3.9.8 # Activate Python 3.9 for the current project
39+
poetry install
40+
```
41+
This requires setting the `virtualenvs.prefer-shell-python` option to `true`.
42+
{{% /note %}}
43+
2944
## Switching between environments
3045

3146
Sometimes this might not be feasible for your system, especially Windows where `pyenv`

0 commit comments

Comments
 (0)