EMACS Configuration Python Programming environment

Source: Internet
Author: User
Tags virtual environment

The Python programming environment setting involves: auto-completion, syntax checking, and virtual environments.

In order not to mess up the system, install the relevant plugin in Python's virtual environment.

First, install the Python virtual environment virtualenvwrapper
sudo apt-get virtualenvwrapper

Then create a virtual environment:

Test

Let's start with the test in this virtual environment:
First look at what packages are available:

$ pip listpip (1.5. 6 ) Setuptools (5.5. 1)

You can see only 2 packages.

The following is the beginning of installation in a virtual environment!

Second, in the virtual environment to install the relevant package Jedi, Pylint
Install

Description
Jedi---------Python auto-complete;
Pylint-------The grammar check of Python;

After installation, look at what's loaded:

$ pip Listastroid (1.3.6) Jedi (0.9.0) Logilab-common (0.63.2)Pip (  1.5. 6 )pylint (1.4.3)setuptools (5.5. 1 )Six (1.9.0)
Third, install the relevant plug-ins in Emacs Elpy, Flycheck,Company-jedi,virtualenvwrapper
M-x package-list-packages

Installation

    1. Elpy
    2. Flycheck
    3. Company-jedi
    4. Virtualenvwrapper
Iv. Modifying the Emacs configuration file
 ;; add a warehouse (Require'Package )(Setq package-archives'(("GNU"."http://elpa.gnu.org/packages/")             ("Melpa"."http://melpa.milkbox.net/packages/")) ) ( package-Initialize)
;; auto-complete : Company (Require'Company )(Add-hook'After-init-hook'global-company-mode); global Open(setq Company-show-numbers t); show serial number(setq Company-idle-delay0.2); menu Delay(setq Company-minimum-prefix-length1)start to complete the word count. ;; elpy---lead (Require'elpy)(elpy-enable) ;; Grammar check: Flycheck (Add-hook'After-init-hook #'global-flycheck-mode), Global open; close Flymake, using Flycheck (when (Require'flycheck Nil T)(Setq elpy-modules (DELQ'elpy-module-flymake elpy-modules))(Add-hook'Elpy-mode-hook'flycheck-mode)) ;; Virtual environment: Virtualenv Wrapper(Require'virtualenvwrapper)(venv-initialize-interactive-shells) (Venv-initialize-Eshell) (Setq venv-location"~/pyvirtualenv/"); Set the virtual environment directory;; If there are multiple directories:;; (Setq venv-location'("~/myvenv-1/";;"~/myvenv-2/"));; M-X Venv-workon Open Virtual Environment

This is the simplest Python programming environment to configure.

Note: Add the following 2 lines to the. bashrc file in your home directory
#tells Virtualenvwrapper where to store the Virtualenvs that would be created and used. Export Workon_home=~/p Yvirtualenv/usr/share/virtualenvwrapper/virtualenvwrapper. SH

pyvirtualenv is the directory where the virtual environment is placed and can be changed to the name you want. This makes the virtualenvwrapper more flexible to use.

RELATED Links: https://github.com/jorgenschaefer/elpyhttp://www.pylint.org/#myCarousel

EMACS Configuration Python Programming environment

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.