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

Python 3 support #212

Closed
octothorpeSpeed opened this issue Sep 25, 2017 · 6 comments
Closed

Python 3 support #212

octothorpeSpeed opened this issue Sep 25, 2017 · 6 comments
Labels
is:feature Adds or requests new features, or extends existing ones is:support A request for user support: questions, how-to's, and discussions

Comments

@octothorpeSpeed
Copy link

Hello.
I was curious if there is any easy way to use Python 3 in place of Python 2.
Thank you

@hlissner
Copy link
Member

hlissner commented Sep 25, 2017

This strongly depends on how you manage python versions on your system. I use pyenv, which lets me set the default python versions system-wide, for the current shell, or for specific directories, and Doom is configured to pick this up. So if you have python3 enabled, syntax checking, code evaluation, the repl, etc. should all be using python 3. You'd also be able to see it in the mode-line:

python version in mode-line

If pyenv isn't for you, this should be enough to get everything working (assuming your python executable is named "python3"):

(setq python-shell-interpreter "python3"
      flycheck-python-pycompile-executable "python3")

Let me know if that works for you.

@jcrotts
Copy link

jcrotts commented Sep 26, 2017

Conda is also a great way to manage python virtual environments!

@kwsp
Copy link

kwsp commented Apr 21, 2020

This strongly depends on how you manage python versions on your system. I use pyenv, which lets me set the default python versions system-wide, for the current shell, or for specific directories, and Doom is configured to pick this up. So if you have python3 enabled, syntax checking, code evaluation, the repl, etc. should all be using python 3. You'd also be able to see it in the mode-line:

python version in mode-line

If pyenv isn't for you, this should be enough to get everything working (assuming your python executable is named "python3"):

(setq python-shell-interpreter "python3"
      flycheck-python-pycompile-executable "python3")

Let me know if that works for you.

Hi hlissner, the command

(setq python-shell-interpreter "python3"
      flycheck-python-pycompile-executable "python3")

did not work for me and my doom emacs still detects python2.7. I don't use pyenv and I just run python3 to launch python3. What can I do to make doom show python3?

@hlissner
Copy link
Member

hlissner commented Apr 22, 2020

@tiega Can you be more specific? Where does it "show python3"? If in the modeline, then add this to your config:

(setq doom-modeline-env-python-executable "python3")

See doom-modeline for other config options.

@kwsp
Copy link

kwsp commented Apr 22, 2020

@hlissner Yes in my modeline it still shows python 2.7.17 even after adding the following to my config:

(setq python-shell-interpreter "python3"
      flycheck-python-pycompile-executable "python3")
(setq doom-modeline-env-python-executable "python3")

Anything else I could try? Thanks!

@hlissner
Copy link
Member

hlissner commented Apr 22, 2020

This alone worked for me (in vanilla Doom).

(after! python
  (setq python-shell-interpreter "python3"))

If it doesn't work for you, please double check your config. There is likely a conflict.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 31, 2021
@hlissner hlissner added is:support A request for user support: questions, how-to's, and discussions and removed is:discourse labels May 4, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
is:feature Adds or requests new features, or extends existing ones is:support A request for user support: questions, how-to's, and discussions
Projects
None yet
Development

No branches or pull requests

4 participants