# /usr/local/Cellar/pyenv/1.2.21/libexec/pyenv: No such file or directoryのエラーの対処方法

## /usr/local/Cellar/pyenv/1.2.21/libexec/pyenv: No such file or directoryのエラーの対処方法

Pythonに依存のコマンド実行時に、以下のようなエラーが出力されるようになりました。

```
$ aws --version                                                                                                      
/Users/hayashier/.pyenv/shims/aws: line 21: /usr/local/Cellar/pyenv/1.2.21/libexec/pyenv: No such file or directory
```

`brew upgrade`でコマンド実行時に、pyenvのバージョンが上がったことに起因しており、ファイルパスの変更があったことによるもののようです。そのため、以下のコマンドを実行することで事象が解消されました。

```
$ pyenv rehash
```

正常にコマンドが実行できるようになったことが確認できます。

```
$ aws --version
aws-cli/1.19.1 Python/3.9.0 Darwin/19.6.0 botocore/1.20.78
```

* References
  * [RFE: pyenv update should regenerate shims unconditionally #1068](https://github.com/pyenv/pyenv/issues/1068)
  * [pyenvをアップデートしたらlibexec/pyenv: No such file or directoryとか言われた話](https://e-tec-memo.herokuapp.com/article/233/)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://hayashier.gitbook.io/article/development/pyenv-no-such-file-error.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
