Test on a Mac
ipythonin [4]: import sys in [5]: sys.pathout[5]: [', '/usr/local/bin ', '/library/python/2.7/site-packages/pip-9.0.1-py2.7.egg ', '/library/python/2.7/site-packages/ Mysql-0.0.1-py2.7.egg ', '/library/python/2.7/site-packages/ipython-3.2.1-py2.7.egg ', '/Library/ Python/2.7/site-packages/gnureadline-6.3.3-py2.7-macosx-10.8-intel.egg ', '/System/Library/Frameworks/ Python.framework/versions/2.7/lib/python27.zip ', '/system/library/frameworks/python.framework/versions/ 2.7/lib/python2.7 ', '/system/library/frameworks/python.framework/versions/2.7/lib/python2.7/plat-darwin ', '/system/library/frameworks/python.framework/versions/2.7/lib/python2.7/plat-mac ', '/System/Library /frameworks/python.framework/versions/2.7/lib/python2.7/plat-mac/lib-scriptpackages ', '/System/Library/ Frameworks/python.framework/versions/2.7/extras/lib/python ', '/system/library/frameworks/python.framework /versions/2.7/lib/python2.7/Lib-tk ', '/system/library/frameworks/python.framework/versions/2.7/lib/python2.7/lib-old ', '/System/ Library/frameworks/python.framework/versions/2.7/lib/python2.7/lib-dynload ', '/System/Library/Frameworks/ PYTHON.FRAMEWORK/VERSIONS/2.7/EXTRAS/LIB/PYTHON/PYOBJC ', '/library/python/2.7/site-packages ', '/ Library/python/2.7/site-packages/ipython-3.2.1-py2.7.egg/ipython/extensions ', '/private/var/root/.ipython ‘]
The code has, we also need to put the script in python specified directory, you can use Sys.path to see
(Linux server): Generally we will put this type of code in the/usr/local/lib/python2.7/dist-packages directory
(Mac is stored in this directory)/library/python/2.7/site-packages
Admindemacbook-air-62:site-packages admin$ vim tab.py #!/usr/bin/env python # python startup file import Sysimport Readlin Eimport rlcompleterimport atexitimport os# tab Completion readline.parse_and_bind (' Tab:complete ') # History file Histfile = Os.path.join (os.environ[' HOME '), '. Pythonhistory ') try:readline.read_history_file (histfile) except IOError:passatexit.register (Readline.write_history_file, histfile) del os, Histfile, ReadLine, Rlcompleter
You can import tab in the code
In [11]: import tabin [12]: sys.sys.__class__ (         SYS.__SETATTR__ ( sys.displayhook ( sys.getrecursionlimit ( sys.prefixsys.__delattr__ ( sys.__sizeof__ ( sys.dont_write_bytecode Sys.getrefcount ( sys.ps1sys.__dict__ sys.__stderr__ sys.exc_clear ( &nbsP; sys.getsizeof ( sys.ps2sys.__displayhook__ ( sys.__stdin __ sys.exc_info ( sys.gettrace ( sys.ps3sys.__doc__ sys.__stdout__ sys.exc_type sys.hexversion sys.py3kwarningsys.__egginsert &nBSP;       SYS.__STR__ ( sys.excepthook ( sys.last_traceback sys.setcheckinterval (sys.__excepthook__ ( sys.__ subclasshook__ ( sys.exec_prefix sys.last_type ( sys.setdlopenflags (sys.__format__ ( sys._clear_type_cache ( sys.executable sys.last_value &nbSp; sys.setprofile (sys.__getattribute__ ( sys._current_frames ( sys.exit ( sys.long_info Sys.setrecursionlimit (sys.__hash__ ( sys._getframe ( sys.exitfunc ( sys.maxint sys.settrace (sys.__init__ ( sys._mercurial sys.flags sys.maxsize sys.stderrsys.__name __ sys.api_ version sys.float_info sys.maxunicode sys.stdinsys.__new__ ( sys.argv sys.float_repr _style sys.meta_path sys.stdoutsys.__package__ sys.builtin_module_names sys.getcheckinterval ( sys.modules sys.subversionsys.__plen sys.byteorder sys.getdefaultencoding ( sys.path  SYS.VERSIONSYS.__REDUCE__ ( Sys.call_tracing ( &NBsp; sys.getdlopenflags ( sys.path_hooks sys.version_infosys.__reduce_ex__ ( Sys.callstats ( Sys.getfilesystemencoding ( sys.path_importer_cache sys.warnoptionssys. __REPR__ ( sys.copyright Sys.getprofile ( sys.platform in [12]: sys.
This article comes from "Plum blossom fragrance from bitter cold!" "Blog, be sure to keep this provenance http://daixuan.blog.51cto.com/5426657/1934112
Python Tab key