0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

Pipenvの仮想環境でコマンドの実行履歴を表示できないエラーの対処

Posted at

エラー内容

Windows10のコマンドプロンプトでpipenv shellを実行して仮想環境に入ると、上下キーによるコマンド履歴が利かなくなる。本来であれば、上下キーを押すと過去に実行したコマンドを順番に表示することができるのだが、仮想環境内では上下キーを押しても何も表示されない。仮想環境を出ると上下キーは復活する。

実行環境:

  • Windows10 Home バージョン21H1 OSビルド19043.1237
  • Pipenv version 2021.5.29

解決方法

pipenv run cmdを代わりに実行する。

解説

「pipenv command prompt history」で調べると、以下のissueがヒット。
up/down arrow history doesn't work on pipenv shell on windows
その中で、このリプライを試したところ解決した。
以下はその日本語訳。

(いくつか試してみて)やっと分かりました。pipenv run cmdを実行すると、その環境が使えるようになり、そこからIDEを起動することもできるようになります(VS Codeならcode .)。また、VS Codeの中のターミナルからもpipenvで入れたものを確認できます。

そして、コマンド履歴も利きます(上矢印で)。

とりあえずこれが利かせる方法のようです。何か欠点があるかは気になりますが。

Windowsの pipenv shellでも履歴機能が使いたいにはPowerShellを使う回避策も紹介されている。一応参考までに。

まとめ

Pipenvで入った仮想環境で上下キーが利かないときは、pipenv run cmdを試してみるといい。対症療法ではあるが、ひとまずなんとかなると思われる。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?