Skip to content

poetry shell cannot work #6

Open
@allrobot

Description

@allrobot

Description

I try to run code from https://python-poetry.org/docs/basic-usage/#using-poetry-run, but it reports error...

poetry new project
cd project
conda activate your_env_name
which python
poetry run which python
poetry shell
which python
C:\Users\Administrator\Personal_scripts\Python\PythonScripts\ddd\poetry-demo>activate python312

(python312) C:\Users\Administrator\Personal_scripts\Python\PythonScripts\ddd\poetry-demo>which python
/c/ProgramData/anaconda3/envs/python312/python

(python312) C:\Users\Administrator\Personal_scripts\Python\PythonScripts\ddd\poetry-demo>poetry run which python
/c/ProgramData/anaconda3/envs/python312/python

(python312) C:\Users\Administrator\Personal_scripts\Python\PythonScripts\ddd\poetry-demo>poetry shell
Spawning shell within C:\ProgramData\anaconda3\envs\python312
'C:\ProgramData\anaconda3\envs\python312\Scripts\activate.bat' 不是内部或外部命令,也不是可运行的程序
或批处理文件。

(python312) C:\Users\Administrator\Personal_scripts\Python\PythonScripts\ddd\poetry-demo>

不是内部或外部命令,也不是可运行的程序
或批处理文件。

It's mean: It is not an internal or external command, nor is it a runnable program
Or batch file.

Workarounds

No....

Poetry Installation Method

system package manager (eg: dnf, apt etc.)

Operating System

Win10 Enterprise 21H2

Poetry Version

1.8.3

Poetry Configuration

(python312) C:\ProgramData\anaconda3\envs\python312>poetry config --list
cache-dir = "C:\\Users\\Administrator\\AppData\\Local\\pypoetry\\Cache"
experimental.system-git-client = false
installer.max-workers = null
installer.modern-installation = true
installer.no-binary = null
installer.parallel = true
keyring.enabled = true
solver.lazy-wheel = true
virtualenvs.create = true
virtualenvs.in-project = null
virtualenvs.options.always-copy = false
virtualenvs.options.no-pip = false
virtualenvs.options.no-setuptools = false
virtualenvs.options.system-site-packages = false
virtualenvs.path = "{cache-dir}\\virtualenvs"  # C:\Users\Administrator\AppData\Local\pypoetry\Cache\virtualenvs
virtualenvs.prefer-active-python = false
virtualenvs.prompt = "{project_name}-py{python_version}"
warnings.export = true

Python Sysconfig

(python312) C:\ProgramData\anaconda3\envs\python312>python -m sysconfig
Platform: "win-amd64"
Python version: "3.12"
Current installation scheme: "nt"

Paths:
        data = "C:\ProgramData\anaconda3\envs\python312"
        include = "C:\ProgramData\anaconda3\envs\python312\Include"
        platinclude = "C:\ProgramData\anaconda3\envs\python312\Include"
        platlib = "C:\ProgramData\anaconda3\envs\python312\Lib\site-packages"
        platstdlib = "C:\ProgramData\anaconda3\envs\python312\Lib"
        purelib = "C:\ProgramData\anaconda3\envs\python312\Lib\site-packages"
        scripts = "C:\ProgramData\anaconda3\envs\python312\Scripts"
        stdlib = "C:\ProgramData\anaconda3\envs\python312\Lib"

Variables:
        BINDIR = "C:\ProgramData\anaconda3\envs\python312"
        BINLIBDEST = "C:\ProgramData\anaconda3\envs\python312\Lib"
        EXE = ".exe"
        EXT_SUFFIX = ".cp312-win_amd64.pyd"
        INCLUDEPY = "C:\ProgramData\anaconda3\envs\python312\Include"
        LIBDEST = "C:\ProgramData\anaconda3\envs\python312\Lib"
        TZPATH = "C:\ProgramData\anaconda3\envs\python312\share\zoneinfo"
        VERSION = "312"
        VPATH = "..\.."
        abiflags = ""
        base = "C:\ProgramData\anaconda3\envs\python312"
        exec_prefix = "C:\ProgramData\anaconda3\envs\python312"
        installed_base = "C:\ProgramData\anaconda3\envs\python312"
        installed_platbase = "C:\ProgramData\anaconda3\envs\python312"
        platbase = "C:\ProgramData\anaconda3\envs\python312"
        platlibdir = "DLLs"
        prefix = "C:\ProgramData\anaconda3\envs\python312"
        projectbase = "C:\ProgramData\anaconda3\envs\python312"
        py_version = "3.12.0"
        py_version_nodot = "312"
        py_version_nodot_plat = "312"
        py_version_short = "3.12"
        srcdir = "C:\ProgramData\anaconda3\envs\python312"
        userbase = "C:\Users\Administrator\AppData\Roaming\Python"

Example pyproject.toml

No response

Poetry Runtime Logs

(python312) C:\Users\Administrator\Personal_scripts\Python\PythonScripts\ddd\poetry-demo>poetry -vvv shell
Loading configuration file C:\Users\Administrator\AppData\Roaming\pypoetry\config.toml
Using virtualenv: C:\ProgramData\anaconda3\envs\python312
Virtual environment already activated: C:\ProgramData\anaconda3\envs\python312

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions