python / python/cpython

venv should include python-config in the virtual environment

Aberta
#135,147 2 comentários 2 reações 0 responsáveis Ver no GitHub

Ninguém assumiu esta issue ainda.

stdlib topic-venv type-bug
Linguagem predominante
Python
Estrelas
77.2k
Forks
35.9k
Métricas de merge de PRs
Métricas de PR pendentes

Descrição

Bug report

Bug description:

When venv creates a virtual environment it puts the specified python binary from the python distributions bin directory into the virtual environment's bin directory. It does not add the python-config script from the python distribution's bin directory to the virtual environment's bin directory. I, and many others, believe that it should.

From the Debian python-config man page:

python-config helps compiling and linking programs, which embed the Python interpreter, or extension modules that can be loaded dynamically (at run time) into the interpreter.

Any python project that is going to include a custom module written in C is going to want to use python-config to help compile and link that C code. It's going to want to use the python-config for the version of python that the rest of the project is using (from the virtual environment). Currently that is very difficult because python-config is not part of the virtual environment. This defeats the safety and convenience of virtual environments.

There are several different threads of people asking for this in virtualenv, pyvenv, anaconda, uv, etc., and most of those projects say, "well, the built-in venv doesn't put python-config in the virtual environment's bin directory, so we aren't going to do it either." Yet there seems to be no reason why python-config is not put into the virtual environment along with python.

Links to those discussions:

https://github.com/pypa/virtualenv/issues/169

https://github.com/pypa/virtualenv/issues/1808

https://github.com/pyenv/pyenv-virtualenv/issues/459

https://stackoverflow.com/questions/42020937/why-pyvenv-does-not-install-python-config

https://travis-ci.community/t/python-config-is-not-set-up-corresponding-to-build-python-version/10098

https://github.com/ContinuumIO/anaconda-issues/issues/1009

https://github.com/astral-sh/uv/issues/10263

CPython versions tested on:

3.13

Operating systems tested on:

Linux

Guia de contribuição

Abrir o guia de contribuição

Primeiros passos

  1. Leia a issue inteira e depois o guia de contribuição do projeto.
  2. Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
  3. Faça um fork do repositório e trabalhe em uma branch.
  4. Abra um pull request que referencie o número da issue.

Direção de pesquisa

Comece localizando a implementação de venv e seus testes específicos para Linux; em seguida, rastreie como o executável Python do ambiente é selecionado e instalado. Adicione cobertura de testes mostrando que o python-config correspondente está disponível no diretório bin do ambiente e verifique o comportamento no Linux com Python 3.13.

Escrita pelo modelo de indexação a partir do texto da issue.

Avaliação

Stack de tecnologia
python
Domínio
tooling
Tipo de issue
Funcionalidade
Dificuldade
3/5
Tempo estimado
1-2 dias
Status de atividade
Pouca atividade
Clareza
Razoavelmente clara
Facilidade para iniciantes
55/100

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.