Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Q] Default Python interpreter #395

Closed
jaklan opened this issue Apr 28, 2020 · 4 comments
Closed

[Q] Default Python interpreter #395

jaklan opened this issue Apr 28, 2020 · 4 comments

Comments

@jaklan
Copy link

jaklan commented Apr 28, 2020

Hi, I can't find it in docs - in what way the default Python interpreter path is resolved? I'm using Python 3.7 with Homebrew, but I also have Python@3.8 which was installed as a dependency by some library. It's Keg-only, so it's not visible in /usr/local/bin. But since then, the packages were installed with Python 3.8 by default and I had to manually use --python flag to switch it back to 3.7 each time. I even deleted .local/pipx/shared folder and tried to recreate with reinstall-all, but 3.8 was used anyway as long as I didn't use --python flag.

@uranusjr
Copy link
Member

uranusjr commented Apr 28, 2020

The default Python interpreter is whatever sys.executable reports (i.e. what pipx was initially installed against), and PATH has no effect on it. This can cause problems with a few environments, and there are workarounds available. My pipx-standalone for example carries a patch to use perform custom Python version detection. Also see #146, #294. I think this is an issue the Homebrew formula maintainers need to address, but maybe pipx can organise the code to make it easier for downstream packagers to patch the default Python inrepreter logic.

@jaklan
Copy link
Author

jaklan commented May 1, 2020

@uranusjr thanks for the answer. As I cen see, pipx formula in Homebrew depends on Keg-only python@3.8 (for whatever reason), so as I understand that would be the default interpreter. Is there any way to install pipx via brew with another Python version, e.g. 3.7?

@AlJohri
Copy link
Contributor

AlJohri commented May 1, 2020

@jaklan No, brew installed pipx always uses the latest python. Homebrew is slowly porting all formula to manually depend on python 3.8. When this is complete, the global brew python will also change from 3.7 to 3.8.

@itsayellow
Copy link
Contributor

itsayellow commented Nov 19, 2020

Closing because #448 clears up documenting this (use pipx install --help to see what pipx thinks is the default python executable) and also allows setting the default python (use PIPX_DEFAULT_PYTHON env variable.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants