Loading ...
Sorry, an error occurred while loading the content.

How do i get macvim to recognozie a python virtualenv automatically?

Expand Messages
  • Oskar
    I use macvim built with python interpreter support on OS X lion for python coding. In order for omnicompletion to work with the libraries for a particular
    Message 1 of 4 , Aug 16, 2011
    • 0 Attachment
      I use macvim built with python interpreter support on OS X lion for
      python coding. In order for omnicompletion to work with the libraries
      for a particular python virtualenv I would like macvim to recognize
      that it is opened within an activated python virtualenv. On ubuntu
      this works exactly like i expect it to; If I open vim in an activated
      virtualenv, all libs specific to that virtualenv are on python's path.
      This does not work in macvim when launched from the mvim shell script
      inside an activated virtualenv. Instead, the python path consists of
      the global python's libs. I know there is a way around this with some
      semi heavy vim-scripting, but I would prefer it if it behaves like on
      ubuntu. I would at least want to know why it doesn't behave that way.
      Any ideas are welcome.

      --
      You received this message from the "vim_mac" maillist.
      Do not top-post! Type your reply below the text you are replying to.
      For more information, visit http://www.vim.org/maillist.php
    • dacresni
      i don t know the syntax, (I ll get back to you) but you should be able to change vim s environmental variables from within the .vimrc which is executed at
      Message 2 of 4 , Aug 17, 2011
      • 0 Attachment
        i don't know the syntax, (I'll get back to you) but you should be able to change vim's environmental  variables from within the .vimrc  which is executed at vim's start. does the virtualenv export any varables into your shell vim may enharit those but perhaps not macvim, forthat you may have to alter your ~/Envornment.plist  actually i forgot the path to that.

        --
        You received this message from the "vim_mac" maillist.
        Do not top-post! Type your reply below the text you are replying to.
        For more information, visit http://www.vim.org/maillist.php
      • Oskar
        This is weird. I compiled my own version of python 2.7.1 in case this was some problem with the osx default python that ships with lion. Then I checked out
        Message 3 of 4 , Aug 17, 2011
        • 0 Attachment
          This is weird. I compiled my own version of python 2.7.1 in case this
          was some problem with the osx default python that ships with lion.
          Then I checked out snapshot 61 of macvim from github and built it with
          python support and referenced my newly compiled python config dir like
          this:

          ./configure --with-features=huge --enable-pythoninterp --enable-
          rubyinterp --enable-perlinterp --enable-cscope --with-python-config-
          dir=/Users/oskar/opt/python271/lib/python2.7/config/

          I activated my virtualenv and launch mvim.

          I ran
          :python print sys.executable

          I got the executable from the virtualenv, nice.

          I ran
          :echo $PATH

          I got the path as modified by virtualenv (this is pretty much what
          virtualenv does btw, modifies the $PATH), nice.

          I ran
          :python print sys.path

          I got the system wide path from the "global" system python, BAD.

          What does the --with-python-config-dir="..." param to configure even
          do?

          It looks like something is done statically, where it should be done
          dynamically. Please enlighten me. Any ideas are welcome.

          Why does this work on a vanilla ubuntu installation and not on OSX?



          --
          You received this message from the "vim_mac" maillist.
          Do not top-post! Type your reply below the text you are replying to.
          For more information, visit http://www.vim.org/maillist.php
        • ilya belsky
          *--enable-pythoninterp=dynamic* helps me to compile macvim with support of my python 2.7 instead of default system python 2.6. But after that python in vim not
          Message 4 of 4 , Sep 6, 2011
          • 0 Attachment
            --enable-pythoninterp=dynamic helps me to compile macvim with support of my python 2.7 instead of default system python 2.6.
            But after that python in vim not working: then I type :py import sys it raises an error: E370: Could not load library libpython2.7.a
            May be in your system it will be work fine :)

            --
            You received this message from the "vim_mac" maillist.
            Do not top-post! Type your reply below the text you are replying to.
            For more information, visit http://www.vim.org/maillist.php
          Your message has been successfully submitted and would be delivered to recipients shortly.