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 1 year has passed since last update.

pipx: The term 'pipx' is not recognized as a name of a cmdlet, function, script file, or executable program.の対処法

Last updated at Posted at 2022-06-07

備忘録も兼ねて。

経緯

pipxを使ってみようと思い、
pip install --user pipxでインストールして
pipx ensurepathでパスを通したあと、
blackを使うためにpipx install blackとしたら、以下のエラーが赤文字で出た

pipx: The term 'pipx' is not recognized as a name of a cmdlet, function, script file, or executable program.
Check the spelling of the name, or if a path was included, verify that the path is correct and try again.

原因と対処法

pipx ensurepathで自動的に通された環境変数パスが、何故かすべて小文字になっているのが原因

正しいパスを環境変数に入れてやれば解決する

正しいパスは、pipx ensurepathをはじめてしたときに出てくる

Success! Added C:\Example1\hoge to the PATH environment variable.
Success! Added C:\Example2\hoge to the PATH environment variable.

Consider adding shell completions for pipx. Run 'pipx completions' for instructions.

Otherwise pipx is ready to go! ✨ 🌟 ✨

というメッセージの
Success! Added [Path] to the PATH environment variable.
の部分(今回は適当なパスで置き換えている)

pipx ensurepathが2回目以降なら、

C:\Example1\hoge is already in PATH.
C:\Example2\hoge is already in PATH.

⚠️  All pipx binary directories have been added to PATH. If you are sure you want to proceed, try again with the '--force' flag.      

Otherwise pipx is ready to go! ✨ 🌟 ✨

[Path] is already in PATH. の部分にある

この部分に表示されたパスが正しいパスなので、コピーして環境変数へとペーストする

環境変数の設定の仕方は、
Windows(10)の場合はまず、環境変数のウィンドウを開く(開き方)
開いたウィンドウの[UserName]のユーザー環境変数Path内に先程コピーしたパスが小文字であるはずなので、それらを正しいパスで置換して完了

これでターミナルを再起動すればちゃんとインストールできるはず

参考サイト

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?