Pyenv virtualenv does not shim pip - uses shimmed python, system pip

Đang mở
#325 6 bình luận 10 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
35/100
Loại issue
Lỗi
Độ rõ ràng
Cần làm rõ
Mức độ hoạt động
Đình trệ
Công nghệ
python, shell
Lĩnh vực
cli

Hướng nghiên cứu

Reproduce the sequence using pyenv install, pyenv virtualenv, pyenv activate, which python, which pip, and pyenv rehash. Trace why Python resolves through /Users/bar/.pyenv/shims/python while pip resolves to /usr/local/bin/pip; done means pip targets the activated virtualenv and installed packages are available to its Python.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

I have been using (Homebrew) pyenv and pyenv-virtualenv for a long time, and my usual procedure for creating a virtual environment (with 3.7.4, for example) is:

pyenv install 3.7.4
pyenv virtualenv 3.7.4 foo
pyenv activate foo

This works fine, and running which python gives:
/Users/bar/.pyenv/shims/python
And python --version gives:
Python 3.7.4
as expected.

However, doing the same for pip gives:
/usr/local/bin/pip
i.e., the system pip. This also means that pip installing anything installs it to the system python, not to the virtualenv (packages are not subsequently available in the virtualenv, e.g. pip install django, followed by running a python django app, complains that there is no django installed)

This suggests that there is no shim for pip, which is weird, because this has always worked for me in the past. I have tried uninstalling both pyenv and pyenv-virtualenv, deleting .pyenv, and reinstalling them, but it made no difference.

I have tried running pyenv rehash

Ngôn ngữ chính
Shell
Star
6.7k
Fork
433
Merge trung bình
1 ngày 8 giờ
Pull request đã merge (30 ngày)
11

Chuẩn bị môi trường

Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. 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.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của pyenv/pyenv-virtualenv

Tất cả issue của pyenv/pyenv-virtualenv

Issue tương tự

Thêm issue về Shell/Bash

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.