Pyenv:重建Python后如何“重建” virtualenvs

时间:2019-07-11 17:36:30

标签: python-3.x virtualenv pyenv

我重建了python 3.7以使pyinstaller在Mac上运行,并且似乎已使用3.7.0删除了我所有的virtualenvs。

.python-version文件仍然存在,它们指向我期望的位置。但是当我运行“ pyenv virtualenvs”时,根本没有python3环境,并且在项目目录中,python命令根本不起作用。

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.

1 个答案:

答案 0 :(得分:0)

我不知道如何重建pyenv,尽管对我来说:

$ pyenv install $(previously installed python name to update)

$ pyenv rehash

重建python和更新的垫片就可以了。