Coder Social home page Coder Social logo

Comments (17)

seagle0128 avatar seagle0128 commented on July 17, 2024

Did you set $PATH for Emacs correctly? Please check with M-x get-env RET PATH and S-M ! python --version RET.

from doom-modeline.

karambaq avatar karambaq commented on July 17, 2024

@seagle0128
2018-08-03 18 42 40
python version says it 2.7.15

from doom-modeline.

seagle0128 avatar seagle0128 commented on July 17, 2024

I believe Python 2.7 is used in your emacs env. You should use exec-path-from-shell on macOS to set env vars from shell correctly.

from doom-modeline.

karambaq avatar karambaq commented on July 17, 2024

Yes, it says 2.7.15

from doom-modeline.

karambaq avatar karambaq commented on July 17, 2024

unfortunately, can't make it work :(

from doom-modeline.

rmvn27 avatar rmvn27 commented on July 17, 2024

I think it's happening, because in line 1154 it searches directy for the "python" executeable. So you would have to change it there directly to "python3".

from doom-modeline.

karambaq avatar karambaq commented on July 17, 2024

@r0m4n27 I set it like that:

(setq python-shell-interpreter "/usr/local/bin/python3"
      flycheck-python-pycompile-executable "/usr/local/bin/python3"
      python-shell-exec-path "/usr/local/bin/python3")

But modeline still showing 2.7.15 version :(

from doom-modeline.

seagle0128 avatar seagle0128 commented on July 17, 2024

@karambaq I think you didn't get the point. The doom-modeline use python --version to get the version. If python is not in the $PATH of Emacs (not in shell), the version is not what you want. Per your description, both python and python3 are in your system. The simple way is make a link symbol for python3, and put it into /usr/local/bin. I don't use python-shell-interpreter since people may use ipython or something else.

Hope it's clear to you. Please close if it does work for you.

from doom-modeline.

seagle0128 avatar seagle0128 commented on July 17, 2024

I'd like close it now since there is no more feedback. Please feel free to reopen if you still have any issue.

from doom-modeline.

bebound avatar bebound commented on July 17, 2024

Thanks to #18 , (setq doom-modeline-python-executable "python3") should works.
However, on my Mac, it changes Python 2.7.10 to Python, the version disappears...

from doom-modeline.

seagle0128 avatar seagle0128 commented on July 17, 2024

@bebound I guess Python2 is not in exec-path. Eval (executable-find doom-modeline-python-executable) in Emacs and check the output, please.

from doom-modeline.

bebound avatar bebound commented on July 17, 2024

If I set the variable to python3, it outputs /usr/local/bin/python3. Otherwise, it outputs /usr/bin/python.

I'm using macOS and Spacemacs, 2.7.10 is the System Python, and I used homebrew to install 2.7.15 and 3.7.0. It seems that the $PATH in Emacs GUI is weird.

In shell, the $PATH is /usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:.:/Users/kk/.gem/ruby/2.3.0/bin/
In emacs, M-x shell, $PATH is /usr/bin:/bin:/usr/sbin:/sbin:.:/Users/kk/.gem/ruby/2.3.0/bin/:.:/Users/kk/.gem/ruby/2.3.0/bin/, I don't know what prepend /usr/bin at the beginning.

from doom-modeline.

seagle0128 avatar seagle0128 commented on July 17, 2024

You should set correct environment variables in Emacs. You can use exec-path-from-shell to import env vars from shell.

from doom-modeline.

bebound avatar bebound commented on July 17, 2024

OK, I'll try this.
But after I set python-executable to python3, the version number disappears, is this correct? /usr/local/bin/python3 is python 3.7.0

from doom-modeline.

seagle0128 avatar seagle0128 commented on July 17, 2024

@bebound I think you don't get the point. after (setq doom-modeline-python-executable "python3"), you still need to confirm if python3 is in exec-path and $PATH in emacs. Or you just use (setq doom-modeline-python-executable "/usr/local/bin/python3").

from doom-modeline.

bebound avatar bebound commented on July 17, 2024

Ahh, I see, thank you.

from doom-modeline.

CruiseDevice avatar CruiseDevice commented on July 17, 2024

I am using this in my init.el

(when (and (executable-find "python3")
             (string= python-shell-interpreter "python"))
    (setq python-shell-interpreter "python3"))

  ;; Env vars
  (with-eval-after-load 'exec-path-from-shell
    (exec-path-from-shell-copy-env "PYTHONPATH"))

from doom-modeline.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.