[SOLVED] My Global Python is using PlatformIO python

I have installed platformIO using the setup script. I haven’t added platformIO binaries to PATH, yet whenever I try to use python, pip for other usage, platformIO python is being used instead of python at /usr/bin/python, (I checked using which command.)

Virtual Environment is not activated yet this is happening, how do I fix this?

I am using Manjaro.

Interesting! I’m afraid I have no idea how or why this occurred. However…

On my laptop I have Linux Mint 21.1 Vera instlled. Looking into $HOME/.platformio/penv/bin I see the following python related files:

cd ~/.platformio/penv/bin
ls -l python*

lrwxrwxrwx 1 norman norman 19 Jul 22 11:11 python -> /usr/bin/python3.10
lrwxrwxrwx 1 norman norman  6 Jul 22 11:11 python3 -> python
lrwxrwxrwx 1 norman norman  6 Jul 22 11:11 python3.10 -> python

This is showing me that PlatformIO detected that I had python 3.10 installed and instead of downloading and installing its own version, it simply sym-linked to the system installation.

I do have PlatformIO on my $PATH too as I like to use the command-line tools more than I like VSCode! However, I currently have it as the last entry in my $PATH.

echo $PATH | tr ":" "\n"

/home/norman/.local/bin
/home/norman/bin
/usr/local/sbin
/usr/local/bin
/usr/sbin
/usr/bin
/sbin
/bin
/usr/games
/usr/local/games
/snap/bin
/home/norman/.platformio/penv/bin

Running which against the various pythons, gives me this:

which python
/usr/bin/python

which python3
/usr/bin/python3

ls -l /usr/bin/python
/usr/bin/python -> python3

ls -l /usr/bin/python3
/usr/bin/python3 -> python3.10

ls -l /usr/bin/python3.10
-rwxr-xr-x 1 root root 5904904 Nov 20 15:14 /usr/bin/python3.10

So, I’m definitely using the system version of python 3.

What does your system show for the above commands?

Cheers,
Norm.

I think I found the problem, platformio was being added to the PATH via .profile which I guess I added few months back, when I was first getting started with platformio.

Thank You

1 Like

Good news, thanks for letting me know.

Cheers,
Norm.

1 Like