Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Sublime text3 integrated python3 environment configuration process

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly explains the "Sublime text3 integrated python3 environment configuration process", the content of the article is simple and clear, easy to learn and understand, now please follow the editor's ideas slowly in depth, together to study and learn "Sublime text3 integrated python3 environment configuration process"!

Media version:

Python 3.6

Sublime Text 3

These include:

Sublime font configuration.

Common plug-ins:

Package Control 、 SublimeCodeIntel 、 SublimeREPL 、 SublimeTmpl 、 ColorSublime 、 Anaconda 、 SublimeLinter

1. Basic configuration of sublime.

Configure the python path:

After clicking New Build System, an empty configuration file is generated, and the configuration information is overwritten in this configuration file. The python installation path of this article is "C:\ Program Files\ Python36" (pay attention to distinguish between forward and reverse slashes, please change the path to the actual installation path of python), and then press ctrl+s to save the file in the default path, named "Python3", as follows

{

"cmd": ["C:\ Program Files\ Python36\ python.exe", "- u", "$file"]

"file_regex": "^ [] * File\" (... *?)\ ", line ([0-9] *)"

"selector": "source.python"

}

Configure python, select configured python3

Configure python fonts

Add the appropriate font

{

"auto_complete": true

"auto_match_enabled": true

"color_scheme": "Packages/Color Scheme-Default/Mariana.tmTheme"

"font_face": "Consolas"

"font_size": 14

"ignored_packages":

[

"Vintage"

]

"theme": "Default.sublime-theme"

}

2. Plug-in installation

Ctrl+shift+P

Select the corresponding plug-in after selecting install package enter.

Package Control installation, divided into online installation and offline installation, only demonstrate online installation

Paste the following into the console

Import urllib.request,os,hashlib; h = 'df21e130d211cfc94d9b0905775a7c0f' +' 1e3d39e33b79698005270310898eea76; pf = 'Package Control.sublime-package'; ipp = sublime.installed_packages_path (); urllib.request.install_opener (urllib.request.build_opener (urllib.request.ProxyHandler (); by = urllib.request.urlopen (' http://packagecontrol.io/' + pf.replace ('','% 20')). Read (); dh = hashlib.sha256 (by). Hexdigest () Print ('Error validating download (get% s instead of% s), please try manual install'% (dh, h)) if dh! = h else open (os.path.join (ipp, pf),' wb') .write (by)

Sublime text2 pastes the following:

Import urllib2,os,hashlib; h = '6f4c264a24d933ce70df5dedcf1dcaee' +' ebe013ee18cced0ef93d5f746d80ef60'; pf = 'Package Control.sublime-package'; ipp = sublime.installed_packages_path (); os.makedirs (ipp) if not os.path.exists (ipp) else None; urllib2.install_opener (urllib2.build_opener (urllib2.ProxyHandler (); by = urllib2.urlopen (' http://packagecontrol.io/' + pf.replace ('','% 20')). Read (); dh = hashlib.sha256 (by). Hexdigest () Open (os.path.join (ipp, pf), 'wb') .write (by) if dh = = h else None; print (' Error validating download (got% s instead of% s), please try manual install'% (dh, h) if dh! = h else 'Please restart Sublime Text to finish installation')

Turn off and reopen Sublime Text 3. If you can see the package control item in Perferences- > package settings, the installation is successful.

3. Introduction and installation of common plug-ins

SublimeCodeIntel

Introduction

Full-featured code intelligence and smart autocomplete engine

Jump to Symbol Definition-Jump to the file and line of the definition of a symbol.

Imports autocomplete-Shows autocomplete with the available modules/symbols in real time.

Function Call tooltips-Displays information in the status bar about the working function.

Support language

JavaScript, ES6, Mason, XBL, XUL, RHTML, SCSS, Python, HTML, Ruby, Python, XML, XSLT, Django, HTML5, Perl, CSS, Twig, Less, Smarty, Node.js, Tcl, TemplateToolkit, PHP.

Installation

1.Control+Shift+P opens the Package Control console

two。 Enter install and select the associated install package

3. Enter sublimecodeintel, and then click the sublimecodeintel installation prompt in the list

4. After the installation is complete, the text box appears as follows, or you can see the installed sublimecodeintel plug-in in [Preferences > Package Settings]

5. Open preferences- > packages settings-> Package Control-> Settings-User, and check whether there is the following red box code. If not, add it manually.

6. Click browse Packages in preferences, enter the SublimeCodeIntel folder, create a new .codeintel folder under the current path (.codeintel when the files in windows are named), then enter the .codeintel folder, create a new file "config.log" file, and open the input (take the path "D:\ Anaconda3" as an example below. Please modify it according to the specific installation path during the actual configuration):

"python3": {

"python": "C:\ Program Files\ Python36\ python.exe"

"pythonExtraPaths": [

"C:\ Program Files\ Python36\ DLLs"

"C:\ Program Files\ Python36\ Lib"

"C:\ Program Files\ Python36\ Lib/lib-tk"

"C:\ Program Files\ Python36\ Lib/site-packages"

]

}

As shown in the figure:

7. Save, restart Sublime Text 3

test

Create a new file and save it as a .py file, enter the code to test

SublimeREPL

Introduction

After adding shortcut keys, you can run the current file directly, which is very convenient.

Launch python in local or remote (1) virtualenv.

Quickly run selected script or launch PDB.

Use SublimeText Python console with history and multiline input.

Usage

1. After installing the SublimeREPL plug-in, open Preferences- > Key Bindings, and add the shortcut key:

Code paste:

[{"keys": ["f5"], "caption": "SublimeREPL: Python-RUN current file", "command": "run_existing_window_command", "args": {"id": "repl_python_run", "file": "config/Python/Main.sublime-menu"}}]

test

1. Create a new test.py file, for example:

2. The shortcut key set by the SublimeREPL plug-in above is F5, so press F5 to run successfully as follows

SublimeTmpl

Introduction

After installing the plug-in, you can use the shortcut keys to quickly create new files according to the template.

Usage

1. After installing the SublimeTmpl plug-in, open Preferences- > Package Settings- > SublimeTmpl- > Settings User, and add the following

Add keyboard shortcuts:

{

"caption": "Tmpl: Create python", "command": "sublime_tmpl"

"keys": ["ctrl+alt+n"], "args": {"type": "python"}

}

test

Open Sublime Text 3. The shortcut key set by the SublimeTmpl plug-in above is "Ctrl+alt+n". After pressing the shortcut key, the new file is successfully created as follows

ColorSublime

Introduction

Theme change function is provided, which can be selected according to personal preference.

Usage

1. After installing the ColorSublime plug-in, open Preferences- > Color Scheme..., to select the theme

Anaconda

Introduction

Many functions, such as code hints, are necessary

Installation method

1. Preferences- > Package Settings- > Anaconda- > Settings Default, modify "python_interpreter" to the actual Python installation path

2. Preferences- > Package Settings- > Anaconda- > Settings User, add the following

{

"python_interpreter": "C:\ Program Files\ Python36\ python.exe"

"suppress_word_completions": true

"suppress_explicit_completions": true

"comlete_parameters": true

"swallow_startup_errors": true

"anaconda_linting": false

}

As shown in the figure:

test

1. Open Sublime Text3, create any * .py file, and enter the statement test, as shown in the figure.

SublimeLinter

Introduction

SublimeLinter: code review tool, you can set four working states

Installation method

In the same way as above, enter sublimelinter and prompt the following to indicate that the installation is successful

Other plug-ins include:

Pep8, parameter prompt function

Python pep8 autofromat: code formatting

Make the code more concise!

Shortcut key Ctrl + Shift + R, a good thing, but also saves the work of programmers.

Thank you for reading, the above is the content of "Sublime text3 integrated python3 environment configuration process". After the study of this article, I believe you have a deeper understanding of the Sublime text3 integrated python3 environment configuration process, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report