Skip to content

Conversation

@treyhunner
Copy link
Contributor

Add a new question to the FAQ in the README file on how to have Python Launcher automatically use the same Python version as pyenv

This may fix #107 (it's a step in the direction of documenting pyenv support at least).

Add a new question to the FAQ in the README file on how to have Python Launcher automatically use the same Python version as pyenv
@jefftriplett
Copy link

jefftriplett commented Jun 9, 2021

For macOS + bash, for the BSD versions you'll need:

export PY_PYTHON=$(head -n 1 ~/.pyenv/version | cut -d "." -f 1,2)

or for the GNU/homebrew (which are closer to your Linux versions):

export PY_PYTHON=$(ghead --lines 1 ~/.pyenv/version | gcut --delimiter=. --fields=1,2)

(it's annoying, I know)

@jefftriplett
Copy link

@treyhunner the other subtly is referencing ~/.pyenv/version which should be your globally installed options, vs. ~/.python-version I thought .python-version was more of a folder override.

@treyhunner
Copy link
Contributor Author

For macOS + bash, for the BSD versions you'll need:

export PY_PYTHON=$(head -n 1 ~/.pyenv/version | cut -d "." -f 1,2)

@jefftriplett it looks like this works on Linux too. Maybe the docs should use the shorter -n, -d, and -f arguments for both versions (so we'll only need one)?

@treyhunner the other subtly is referencing ~/.pyenv/version which should be your globally installed options, vs. ~/.python-version I thought .python-version was more of a folder override.

I've always used ~/.python-version because I found it easier to understand and per the README it does seem to be checked before ~/.pyenv/version, but I think you're right that ~/.pyenv/version is considered the right way to do things.

Given that the pyenv docs mention $(pyenv root) everywhere, should we replace ~/.pyenv with $(pyenv root)?

export PY_PYTHON=$(head -n 1 $(pyenv root)/version | cut -d "." -f 1,2)

Changes:

- Use BSD and Linux compatible head and cut options
- Fix fish environment variable setting line
- Read `$(pyenv root)/version` instead of `~/.python-version`
@jefftriplett
Copy link

@treyhunner nice find with pyenv root.

I think that's the better path/less error-prone path for people since it should just work.

@willingc
Copy link

I love that @treyhunner already created a PR for what I was going to file as an issue. @jefftriplett reviewing ❤️

@brettcannon This is fabulous. ☀️

@treyhunner
Copy link
Contributor Author

I love that @treyhunner already created a PR for what I was going to file as an issue. @jefftriplett reviewing

@brettcannon This is fabulous.

🙌 Glad we fix the issue before you opened it @willingc! @jefftriplett and @brettcannon did most of the work of identifying the cause and possible solution. 💖 I love being part of a helpful documentation fix though. 😁

@lorenanicole
Copy link

Obsessed with the turn out from this awesome crew! Yay teamwork!

@brettcannon brettcannon enabled auto-merge (squash) June 10, 2021 19:29
@brettcannon brettcannon merged commit c9e92a5 into brettcannon:main Jun 10, 2021
@brettcannon
Copy link
Owner

Thanks everyone for helping with this!

@treyhunner treyhunner deleted the patch-1 branch June 10, 2021 20:55
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

Successfully merging this pull request may close these issues.

5 participants