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

未关闭
#325 6 条评论 10 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
3/5
预计耗时
1-2 天
新手友好度
35/100
Issue 类型
缺陷
描述清晰度
需要澄清
活跃度
停滞
技术栈
python, shell
领域
cli

调研方向

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.

由索引模型根据 Issue 内容生成。

描述

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

主要语言
Shell
星标
6.7k
派生
433
平均合并
1 天 8 小时
30 天内合并 PR
11

环境准备

这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

pyenv/pyenv-virtualenv 的其他 Issue

查看 pyenv/pyenv-virtualenv 的全部 Issue

相似的 Issue

更多 Shell/Bash Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。