Skip to content

Commit

Permalink
Add FAQ section "How to use Python 3"
Browse files Browse the repository at this point in the history
fixes #86
  • Loading branch information
tkf committed Mar 10, 2014
1 parent 5445731 commit 58bd4f3
Showing 1 changed file with 45 additions and 0 deletions.
45 changes: 45 additions & 0 deletions doc/source/index.rst
Expand Up @@ -381,6 +381,51 @@ See also :el:symbol:`jedi:install-server`.
will *not* update Python dependencies anymore.


How to use Python 3 (or any other specific version of Python)
-------------------------------------------------------------

Using Python 3 as default Python, only in Jedi.el
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Set :el:symbol:`jedi:environment-virtualenv` and
:el:symbol:`jedi:environment-virtualenv`, like this::

(setq jedi:environment-root "jedi") ; or any other name you like
(setq jedi:environment-virtualenv
(append python-environment-virtualenv
'("--python" "/PATH/TO/python3")))

Or you can just set, for example, ``virtualenv3`` if it is run by
Python 3::

(setq jedi:environment-virtualenv
(list "virtualenv3" "--system-site-packages"))

.. note:: ``--system-site-packages`` is the default option in
:el:symbol:`python-environment-virtualenv` so you need it if you
want to the default behavior. As to why it is the default, see the
discussion here: `tkf/emacs-python-environment#3
<https://github.com/tkf/emacs-python-environment/issues/3>`_.

.. note:: In principle, you can modify
:el:symbol:`python-environment-virtualenv` and do not touch
:el:symbol:`jedi:environment-virtualenv` *and*
:el:symbol:`jedi:environment-root`. However, it changes default
environment to use Python 3 so make sure all other Python packages
you need are compatible with Python 3.


Automatically use appropriate Python version
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

This can be done by making :el:symbol:`jedi:server-command`,
:el:symbol:`jedi:environment-root` and
:el:symbol:`jedi:environment-virtualenv` buffer local using
:el:symbol:`make-local-variable` and set them appropriately. See
:el:symbol:`jedi:server-command` for more info. You might need to use
:el:symbol:`python-environment-bin`.


How to get traceback
--------------------

Expand Down

0 comments on commit 58bd4f3

Please sign in to comment.