Skip to content

Commit 228f881

Browse files
committed
fix: keep same logic
Signed-off-by: Frost Ming <[email protected]>
1 parent cf58ae3 commit 228f881

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/pdm/cli/commands/use.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
from pdm.models.python import PythonInfo
1212
from pdm.models.venv import get_venv_python
1313
from pdm.project import Project
14+
from pdm.utils import is_conda_base_python
1415

1516

1617
class Command(BaseCommand):
@@ -123,7 +124,10 @@ def do_use(
123124
if python:
124125
use_cache: JSONFileCache[str, str] = JSONFileCache(project.cache_dir / "use_cache.json")
125126
use_cache.set(python, selected_python.path.as_posix())
126-
if selected_python.get_venv() is None and project.config["python.use_venv"]:
127+
128+
if project.config["python.use_venv"] and (
129+
selected_python.get_venv() is None or is_conda_base_python(selected_python.path)
130+
):
127131
venv_path = project._create_virtualenv(str(selected_python.path))
128132
selected_python = PythonInfo.from_path(get_venv_python(venv_path))
129133
if not save:

0 commit comments

Comments
 (0)