背景
- 趣味用のスクレイピングツール作成時、Playwrightの非同期処理を実行するためにPyhon3.11.x が必要らしい
- Python 3.11.x を用いて仮想環境を作成しようとしたらエラー(下記)
PS C:\hoge> py -3.11 -m venv myenv
No suitable Python runtime found
Pass --list (-0) to see all detected environments on your machine
or set environment variable PYLAUNCHER_ALLOW_INSTALL to use winget
or open the Microsoft Store to the requested version.
-
py --list
を実行したところ、Python3.12.x
と3.10.x
しかなかった(下記)
PS C:\hoge> py --list
-V:3.12 * Python 3.12 (64-bit)
-V:3.10 Python 3.10 (64-bit)
方法
- Python公式サイトから Python 3.11.x のインストーラーをDLしてインストール
- ※起動時に
Add Python.exe to PATH
チェックボックスをオンにすること
- ※起動時に
PS C:\hoge> py --list
-V:3.12 * Python 3.12 (64-bit)
-V:3.11 Python 3.11 (64-bit)
-V:3.10 Python 3.10 (64-bit)
仮想環境作成
- 下記手順でOK
PS C:\hoge> py -3.11 -m venv myenv
PS C:\hoge> .\myenv\Scripts\Activate.ps1
(myenv) PS C:\hoge> python --version
Python 3.11.9