Because Mac OS is a UNIX-like system, the basic and Linux system use is not very different, but the user log on automatically execute the environment variable file differences
Mac System:
VI ~/.bash_profile
Linux systems:
ls -A. bash*. bash_history. bash_logout. bash_profile . BASHRC
There are BASH_PROFILE,BASHRC in Linux, the following are the differences:
/etc/profile: This file sets the environment information for each user of the system, and the file is executed the first time the user logs on. and collects the shell settings from the configuration file of the/ETC/PROFILE.D directory.
/ETC/BASHRC: Executes this file for each user running the bash shell. When the bash shell is opened, the file is read.
~/.bash_profile: Each user can use this file to enter shell information dedicated to their own use, when the user logs on, the
The file is only executed once! By default, he sets some environment variables to execute the user's. bashrc file.
~/.BASHRC: This file contains bash information dedicated to your bash shell, which is read when you log in and every time you open a new shell
~/.bash_logout: Executes the file each time it exits the system (exiting the bash shell).
In addition, the variables set in/etc/profile (global) can be applied to any user, while the variables set in ~/.BASHRC, etc. (local) only inherit variables from/etc/profile, they are "parent-child" relationships.
~/.bash_profile is interactive, login way into bash run
~/.BASHRC is an interactive non-login way into bash run
Usually the two settings are roughly the same, so the former usually calls the latter.
Write a Tab.py,code:
import sys import ReadLine import Rlcompleter if sys.platform = = " darwin " and sys.version_info[0 ] = = 2: Readline.parse_and_bind ( bind ^i rl_complete " ) else " tab:complete ")
Then append a line to the. bash_profile file.
Export pythonstartup=/library/frameworks/python.framework/versions/3.5/lib/python3. 5/site-packages/tab.py
source. bash_profile file, you can complete the auto-completion.
In addition, the tab.py storage path can be queried through the SYS module in python:
Import SYS Print (Sys.path)
Execution Result:
>>>Import SYS>>>print (sys.path) ["','/library/frameworks/python.framework/versions/3.5/lib/python35.zip','/library/frameworks/python.framework/versions/3.5/lib/python3.5','/library/frameworks/python.framework/versions/3.5/lib/python3.5/plat-darwin','/library/frameworks/python.framework/versions/3.5/lib/python3.5/lib-dynload','/library/frameworks/python.framework/versions/3.5/lib/python3.5/site-packages']>>>
Typically stored in a directory with site-packages characters.
Mac or Linux system automatically loading Python tab completion function