Linux での PlatformIO 'Can not find working Python 3.6+ interpreter' を修正する方法

問題:

Visual Studio Code で PlatformIO を開こうとすると、次のエラーメッセージが表示されます:

error.txt
PlatformIO: Can not find working Python 3.6+ Interpreter. Please install the latest Python 3 and restart VSCode

VSCode error message showing PlatformIO cannot find working Python 3.6 interpreter

Python3 が既にインストールされているにもかかわらず、です。

解決策

ここでの問題は PlatformIO が Python 3 を見つけられないことではなく、お使いの Python バージョンに venv(仮想環境)がインストールされていないことです!

Ubuntu/Debian では、次のコマンドでインストールできます:

install_venv.sh
sudo apt -y install python3-venv

あるいは、pip を使用してインストールすることもできます:

install_virtualenv.sh
pip install virtualenv

同じカテゴリの類似記事をチェック: PlatformIO Python