Built under Windows Python environment, Ide:eclipse+pydev+flask__python

Source: Internet
Author: User
Tags win32 virtual environment
built under Windows Python environment, Ide:eclipse+pydev+flask Install Python

Download Address: http://www.python.org/

Website download interface generally has two download buttons, respectively, version 3.x and 2.x, download the latest version here. (typically 2.7 should also be installed because there are a lot of Python programs based on 2.7)

Environment Variables
Select ' Add to environment variable ' at installation
You can also manually add to the PATH environment variable: (My installation path is C:\Python\Python35)
C:\Python\Python35\Scripts\; C:\Python\Python35\

Test Run Python
Open the Command Prompt window (commands Prompt), the Python command is available, and the installation is successful.

Pip
The latest version, which has been installed with the PIP selected by default, enters the PIP command and tests whether it is available.

Install Virtualenvwrapper-win
Execute command pip install Virtualenvwrapper-win
The main purpose of installing virtualenvwrapper is to facilitate switching between different versions of the Python run.
The most commonly used commands are as follows: Mkvirtualenv env35: Create a virtual environment, you can specify a different version of the Python executable with the –python=python_exe parameter. Workon: List all virtual environments; Workon Env35: Toggle | Activating virtual Environment Deactivate: deactivating rmvirtualenv env35: removing all virtual environments

Now switch to the ENV35 environment, you can install some extension modules, which takes flask as an example:
Pip Install flask Install JDK

IDE Eclipse requires a Java-run environment.
Download Address: http://www.oracle.com/technetwork/java/javase/downloads/index.html

Download the latest version here. Install Eclipse

Download Address: http://www.eclipse.org/downloads/

The Eclipse Java EE version is selected here because I am Java-friendly and Eclipse is Eclipse+pydev. Installing the Pydev plugin

Online Installation
Open Eclipse,help–>install new software

Click "Add", Name: PyDev, Address: http://pydev.org/updates

Tick components

Offline Installation
If you are unable to install online, you can install it offline by following these measures:
Download offline package, download address: http://pydev.org/download.html

After the download is complete, you can extract the zip package directly into the Eclipse installation directory.
If you do not want to destroy the original eclipse files, you can use link to associate: Create a new Links folder in the directory where Eclipse resides, create a new eclipse directory under the links directory, and extract the Pedev.zip into the Eclipse directory. In the links directory, create a new file Pydev.link, which reads: Path=d:\develop\python\eclipse-jee-mars-1-win32-x86_64\eclipse, D:\Develop\Python\ Eclipse-jee-mars-1-win32-x86_64\eclipse is Eclipse's installation directory reboot eclipse check Pydev plug-in is available, open eclipse–>file–>new–> Project, which is available if the Pydev item exists.
Specify the Python interpreter

Eclipse, window->preference->pydev->python interpreter->new-> Select the installation directory
Hello World

In Eclipse, File->new->project->pydev->pydev project->

The simplest python "Hello world"
You can get started now. hooray! Flask Related Configuration

If you want to use Pydev to develop flask applications, you can configure the following:
1. Use the PIP to install the required extension components.

#切换至虚拟环境env35
Workon env35
#在当前环境下安装flask以及flask扩展组件, some common components are the following
pip install flask
PIP Install Flask-script
pip install flask-bootstrap
pip install flask-moment
pip install flask-wtf
pip install Flask-sqlalchemy
pip install flask-migrate
pip install flask-mail
pip install Flask-login
pip Install Flask-pagedown markdown Bleach #markdown富文本支持
pip install pillow  #图片处理PIL加强版
pip Install Forgerypy #创建模拟数据插件
pip install flask-httpauth
pip install Httpie #测试Web服务

Note: When you use Pydev to develop a flask application, eclipse will have an import problem with the extended component. (Unresolved import error), you can reconfigure the Python interpreter to resolve the problem:
window–> preferences–> Pydev>interpreters>python interpreter–>libraries

Add three directories for the ENV35 virtual environment:

And the Forced Builtins tab, create a new "Flas.ext" item.
Have Fun

Related Article

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.