venv should include python-config in the virtual environment
還沒有人認領這個 Issue。
- 主要語言
- Python
- 星號
- 77.2k
- 分支
- 35.9k
- PR 合併指標
- PR 指標待擷取
描述
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://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
貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
研究方向
首先定位 venv 實作及其 Linux 專用測試,然後追蹤環境的 Python 可執行檔是如何被選取和安裝的。新增測試涵蓋範圍,證明相應的 python-config 在環境的 bin 目錄中可用,並在 Python 3.13 下驗證 Linux 上的行為。
由索引模型根據 Issue 內容生成。
評估
- 技術堆疊
- python
- 領域
- tooling
- Issue 類型
- 功能
- 難度
- 3/5
- 預估耗時
- 1-2 天
- 活躍度
- 冷清
- 描述清晰度
- 基本清楚
- 新手友好度
- 55/100