Docker:WSL:一般ユーザーでDockerコマンドを使う


WSL上のDocker環境でのDockerコマンドを一般ユーザーで使えるようにする

WSLでDockerコマンドを使う際、毎回 "sudo docker…" とするのが面倒なので、
一般ユーザーでもDockerコマンドが実行できるように設定する。

dockerグループに操作者ユーザーを追加すればよい。
sudo usermod -aG docker $USER

いちどログインし直さないとダメみたいなので "logout"コマンド実行してからUbuntuコマンドを起動すればOK


Docker, WSL

Python:WindowsにPython環境を作る


WindowsにPython環境を作る

WindowsにPython環境を作る、どうやれば良い?

Microsoft Storeから「python」で検索、
現時点では3つ候補が出てくる。
・Python 3.13
・Python 3.12
・Python Install Manager

Python 3.13、3.12は何となくわかるが、Python Install Managerって何者?
以下記事によると、Python Install Managerを使うことが推薦、とのこと。
Windows版のPythonのインストール方法が大きく変わる Python Install Managerが登場

Python Install Managerを使うと複数のバージョンのPytyonを管理できるっぽい。

ということでMicrosoft Storeより「Pytyon Install Manager」をインストールした。
途中でWindows Terminalが開き何やら処理が始まるが・・
どうやら旧バージョンのPython(pyコマンド)を入れてたらしい。
Welcome to the Python installation manager configuration helper.

********************************************************************************

Windows is not configured to allow paths longer than 260 characters.

Python and some other apps can exceed this limit, but it requires changing a
system-wide setting, which may need an administrator to approve, and will
require a reboot. Some packages may fail to install without long path support
enabled.
Update setting now? [y/N] y
The setting has been successfully updated, and will take effect after the next reboot.

********************************************************************************

The legacy 'py' command is still installed.

This may interfere with launching the new 'py' command, and may be resolved by
uninstalling 'Python launcher'.
Open Installed apps now? [y/N]    
  
[y]を入力しインストールされているアプリ一覧画面を開いたら
・Python 3.12.3(64-bit)
・Python Launcher
を2024年ごろにインストールしてたっぽいのでアンインストール


これで良いのかわからないが先進める。
Configuring this enables commands like python3.14.exe to run from your
terminal, but is not needed for the python or py commands (for example, py
-V:3.14).

We can add the directory (C:\Users\masat\AppData\Local\Python\bin) to PATH now,
but you will need to restart your terminal to use it. The entry will be removed
if you run py uninstall --purge, or else you can remove it manually when
uninstalling Python.
Add commands directory to your PATH now? [y/N]  
とりあえず [y] でパスには追加。
You do not have the latest Python runtime.

Install the current latest version of CPython? If not, you can use 'py install
default' later to install.

Install CPython now? [Y/n]    
  
最新のPytyonがインストールされていないのでCPythonをインストールするか?だと。
CPytyonって何?
Python = CPython (C言語で記述したPytyon) っぽい。なので[y]でインストールする。

次にオンラインヘルプを表示するか聞いてきた。いらないので[N]
View online help? [y/N]    
  
これでインストールできた?


Python

Windows Terminal:便利ショートカット集


Windows Terminal:便利ショートカット集

コマンドプロンプトの代わりに何気なく使っているWindows Terminal、
実は便利なショートカットが色々とあるっぽい。
見つけたものから順次メモ

◆新しいタブを開く
・規定のプロファイルで開く
[CTRL]+[SHIFT]+[T]

・プロファイルを指定して開く
[CTRL]+[SHIFT]+[SPACE]
プロファイルの一覧が開くのでそこから選択(タブバー右側の下向き矢印クリックと同じ動作)

・プロファイルを指定して開く
[CTRL]+[SHIFT]+数字
[CTRL]+[SHIFT]+[SPACE]で表示したタブドロップダウンメニューをよく見ると、
各プロファイルのショートカットが書いてあるので、よく使うショートカットを覚えておく。

◆新しいターミナルを開く
・[SHIFT]キーを押しながら
[SHIFT]キーを押しながらタブバーの[+]ボタン、もしくはタブドロップダウンメニューをクリック

・[CTRL]+[SHIFT]+[N]
規定のプロファイルで新しいターミナルを開く

◆ターミナルを分割する
・[ALT]+[SHIFT]+[+]
タブの中身を横方向に分割する
CTRL+SHIFT でないことろが紛らわしい

◆タブを閉じる
・[CTRL]+[SHIFT]+[W]
アクティブなタブ、分割したアクティブなペインを閉じる

その他の記事