venv should include python-config in the virtual environment
Chưa có ai nhận issue này.
- Ngôn ngữ chính
- Python
- Star
- 77.2k
- Fork
- 35.9k
- Chỉ số merge pull request
- Chỉ số pull request đang chờ
Mô tả
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
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Hướng nghiên cứu
Bắt đầu bằng việc xác định phần triển khai venv và các bài kiểm thử dành riêng cho Linux, sau đó theo dõi cách tệp thực thi Python của môi trường được chọn và cài đặt. Bổ sung độ bao phủ kiểm thử cho thấy python-config tương ứng có sẵn trong thư mục bin của môi trường, và xác minh hành vi trên Linux với Python 3.13.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- python
- Lĩnh vực
- tooling
- Loại issue
- Tính năng
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức độ hoạt động
- Ít trao đổi
- Độ rõ ràng
- Khá rõ ràng
- Mức phù hợp với người mới
- 55/100