Pyenv:如何在重建 python 后“重建"virtualenvs [英] Pyenv: How to 'rebuild' virtualenvs after rebuilding python
问题描述
我重建了 python 3.7 以使 pyinstaller 在 Mac 上工作,它似乎已经使用 3.7.0 删除了我所有的 virtualenv.
I rebuilt python 3.7 to get pyinstaller to work on Mac, and it seems to have deleted all my virtualenvs using 3.7.0.
.python-version 文件仍然存在,它们指向我期望的位置.但是当我运行 'pyenv virtualenvs' 时,根本没有 python3 环境,而且在项目目录中,python 命令根本不起作用.
The .python-version files still exist, and they point at the location I would expect. But when I run 'pyenv virtualenvs' there's no python3 environments at all, and in the project directory, the python command doesn't work at all.
3.7.0/envs/some-scripts```
```$ ls ~/.pyenv/versions/3.7.0/envs/some-scripts/bin/
activate chardetect macho_find netaddr pydoc pyi-makespec python3
activate.csh easy_install macho_standalone pip pyi-archive_viewer pyi-set_version
activate.fish easy_install-3.7 mako-render pip3 pyi-bindepend pyinstaller
alembic macho_dump natsort pip3.7 pyi-grab_version python```
```$ pyenv virtualenvs
2.7.10/envs/some-scripts-2 (created from /Users/mememe/.pyenv/versions/2.7.10)
2.7.10/envs/gdrive (created from /Users/mememe/.pyenv/versions/2.7.10)
arista-scripts-2 (created from /Users/mememe/.pyenv/versions/2.7.10)
gdrive (created from /Users/mememe/.pyenv/versions/2.7.10)```
See? no 3, and no asterisk, despite being in the project directory.
推荐答案
我不知道你是如何重建 pyenv 的,不过对我来说:
I don't know how did you rebuild pyenv, though for me running:
$ pyenv install $(previously installed python name to update)
比
$ pyenv rehash
重新构建 python 并更新垫片就好了.
Rebuild python and updated shims just fine.
这篇关于Pyenv:如何在重建 python 后“重建"virtualenvs的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!