mise
で Windows に Python もインストールした。
takatoh@sofa: w > mise ls
Tool Version Source Requested
go 1.24.3 C:\Users\takatoh\.config\mise\config.toml 1.24
node 24.1.0 C:\Users\takatoh\.config\mise\config.toml 24
python 3.13.2 C:\Users\takatoh\.config\mise\config.toml 3.13
インストールされてるパッケージを確認しようとしたら、エラーが出た。pip
コマンドが使えない。
takatoh@sofa: w > pip list
pip: The term 'pip' 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.
次のようにしたら使えた。
takatoh@sofa: w > python -m pip list
Package Version
------- -------
pip 24.3.1
poetry をインストールしようとしたけど、pip
コマンドが使えないので当然失敗する。
takatoh@sofa: w > pip install poetry
pip: The term 'pip' 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.
次のようにしたらインストールできた。
takatoh@sofa: w > python -m pip install poetry
さて、poetry インストール時の大量のメッセージの最後のほうに、次のようなメッセージがあった。
WARNING: The script poetry.exe is installed in 'C:\Users\takatoh\AppData\Local\mise\installs\python\3.13.2\Scripts' which is not on PATH.
Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
「poetry.exeは 'C:\Users\takatoh\AppData\Local\mise\installs\phton\3.13.2\Scripts'
にインストールされたけどパスが通ってない。パスを通すか、この警告を無視したいなら --no-warn-script-location
オプションを使え」ってことだ。
poetry だけじゃなくてほかのパッケージに関しても同じメッセージが出てる。pip
コマンドが使えないのも同じ理由かも。
パスを通せば使えるようにはなるのだろうけど、そのパスの中に 3.13.2
というバージョンナンバーが入っている。ということはアップグレードするなどして別のバージョンの Python を使うときにはまたパスを通す作業をしないといけないってことだ。これは面倒だ。
かといって、python -m poetry run
のようにするのも面倒だ。
さて、どうしたもんか。
[追記]
Node.js の npm
コマンドは普通に使える。
takatoh@sofa: sample-project > npm init
This utility will walk you through creating a package.json file.
It only covers the most common items, and tries to guess sensible defaults.
See `npm help init` for definitive documentation on these fields
and exactly what they do.
Use `npm install <pkg>` afterwards to install a package and
save it as a dependency in the package.json file.
Press ^C at any time to quit.
package name: (sample-project)
version: (1.0.0)
description:
entry point: (index.js)
test command:
git repository:
keywords:
author:
license: (ISC)
type: (commonjs)
About to write to C:\Users\takatoh\Documents\w\sample-project\package.json:
{
"name": "sample-project",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC",
"type": "commonjs"
}
Is this OK? (yes)