Install python IDE of python2, python3 and SulimeText3 in Win, and build python2python3.

Source: Internet
Author: User

Install python IDE of python2, python3 and SulimeText3 in Win, and build python2python3.

1. Download and install Sublime Text3. The original intention is not to endure the pycharm open speed, but to enjoy the texture of the fly. Sublime Text3 has been installed for a long time. please google it on your own.

2. Install python2.7 with python3.6 (or another version), https://www.python.org/

1. Download the msi file, which can be directly installed on the UI or uninstalled or modified for ease of use

2. python2.7 and python3.6 can be packed in the same folder for ease of management. They can be named respectively python27 and python36.

3. When you select python2.7, select the latest version 2.7.14.

3. Add path and run python

1. Add the dir of python2 and python3 to the Global path, right-click my computer-properties-advanced system settings-environment variables-system variables-path (edit), and add

D: \ Program Files \ Python \ Python27; D: \ Program Files \ Python \ Python27 \ Scripts;

D: \ Program Files \ Python \ Python36; D: \ Program Files \ Python \ Python36 \ Scripts;

2. Change python.exeunder python27to python27.exe, and modify python36.exe in the same way to identify the interpreter when running. If python is input directly, an error occurs.

3. Enter python27 or python36 in cmd to check whether the installation is successful.

4. Install the python package pip

1, if the installation is python2.7.0, after installation there will be no scripts folder, at this time you can download setuptools.zip in the https://pypi.python.org/pypi/setuptools folder, unzip, in cmd locate the decompressed folder, enter python27 setup. py install to generate the scripts folder in python2. Then you can install pip by positioning it to the scriptsfolder and inputting easy_install.exe pip.

2. If you install Python or Python 3.6.4 in msi, the installation process of pip is the same as that of Python. But when installing Python 3, remember to enter python36 setup. py install instead of python27.

3. After installing pip, you can download the python package. The power of python lies in its package. The installation is carried out in cmd, but the command for the installation package of python2 and python3 is different:
Python2: python27-m pip install <package>

Python3: python36-m pip install <package>

4. view the existing packages in python. The packages in python are basically under Lib, in which site-packages is a package installed with pip, and others are python packages (such as json \ csv \ sys)

Enter python27-m pip freeze in cmd to view the package installed in python27.

Enter python27 --> help in cmd (the input is missing)

5. Configure the python runtime environment in Sublime Text3

1. Edit the compiling environment of sublimetext3, and enter the following command in Tools> Build System> New Build System:

{"Encoding": "UTF-8", "cmd": ["python36.exe", "-u", "$ file"], "path": "D: /Program Files/Python/Python36-32 ", // Note: The Path depends on your own python installation path" file_regex ":" ^ [] * File \"(... *?) \ ", Line ([0-9] *)", "selector": "source. python "}

 

Save it as python36.sublime-build. By default, it is saved in the sublimetext user file. Similarly, python2 is operated and saved as python27.

2. edit a python code for testing.

print("Hello Word!")

 

Select Tools> Build System> python36 and click Ctrl + B to view the output result. Similarly, in Build System, change to python27, which is to explain the script with python2.

6. Add the Sublime Text3 plug-in to experience a better programming environment

1, easily find a configuration sublimetext3 python Runtime Environment Introduction, web site: https://www.jianshu.com/p/a401a0bfddf7

2. Recommended packages: SublimeREPL, SublimeCodeIntel, SublimeLinter, BracketHighLighter, Boxy Theme, and A File Icon

3. SublimeREPL can set a shortcut key to run python, and use its shortcut key to run the line to skip the set operation environment, and directly run python in cmd. By default, it is input python in cmd, however, after the modification, we need to modify the file, specifically: Preferemces --> Browse Packages --> SublimeREPL --> config --> Python --> Main. sublime-menu, as shown in, change python to python27 or python36

4. SublimeLinter needs to download the corresponding pep8 and pyflakes. It is useful to download the corresponding packages in python2 and python3.

 

<PS> for the first time I wrote such a long blog, please pat it!

 

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.