Python:sitecustomize 和 usercustomize
Python提供了两个hook用于定制Python:sitecustomize 和 usercustomize,首先需要查看site包目录,

然后就可以在此目录下创建usercustomize.py文件,文件的内容会影响python的每次调用,除非在调用时使用 -s 选项 禁止自动import。sitecustomize以同样的方式工作,通常由系统管理员定制,它在usercustomize之前被导入。

再次运行交互式解释器:

可以看到,一级提示符变了,但是dir(sys)没有起作用,可以推断,这个地方运行的代码的名称空间与解释器的不一样,这个与pythonstartup文件是不同的
Python:sitecustomize 和 usercustomize的更多相关文章
- 【Python五篇慢慢弹(5)】类的继承案例解析,python相关知识延伸
类的继承案例解析,python相关知识延伸 作者:白宁超 2016年10月10日22:36:57 摘要:继<快速上手学python>一文之后,笔者又将python官方文档认真学习下.官方给 ...
- Python.Module.site
site " This module is automatically imported during initialization. The automatic import can be ...
- Python Tutorial 学习(二)--Using the Python Interpreter
Using the Python Interpreter 2.1. Invoking the Interpreter The Python interpreter is usually install ...
- Python3语法详解
一.下载安装 1.1Python下载 Python官网:https://www.python.org/ 1.2Python安装 1.2.1 Linux 平台安装 以下为在Unix & Linu ...
- Beautifulsoup官方文档
Beautiful Soup 中文文档 原文 by Leonard Richardson (leonardr@segfault.org) 翻译 by Richie Yan (richieyan@gma ...
- Python import hook
转自http://blog.konghy.cn/2016/10/25/python-import-hook/,这里有好多好文章 import hook 通常被译为 探针.我们可以认为每当导入模块的时候 ...
- python 解释器
原文 Python 能让程序紧凑, 可读性增强. 用 Python 写的程序通常比同样的 C, C++ 或 Java 程序要短得多, 这是因为以下几个原因: 高级数据结构使你可以在单独的语句中也能表述 ...
- Python报错“UnicodeDecodeError: 'ascii' codec can't decode byte 0xe9 in position 0: ordinal not in range(128)”的解决办法
最近在用Python处理中文字符串时,报出了如下错误: UnicodeDecodeError: 'ascii' codec can't decode byte 0xe9 in position 0: ...
- python学习笔记(一)
• Python能干嘛?[1]科学计算[2]图形化开发[3]系统脚本[4]Web服务器[5]网络爬虫[6]服务器集群自动化运维 • 常用工具:easy_install.pip.ipython.Subl ...
随机推荐
- Mysql 将结果保存到文件 从文件里运行sql语句 记录操作过程(tee 命令的使用)
1. 有时候我们可能须要记录我们对mysql的操作过程,这时我们能够使用mysql的tee命令 1)第一种情况是在链接数据库的时候使用tee >mysql -u root -p --te ...
- 使用std::find_if提取序列容器的子串
一个需求是这样的,一个vector容器中,我需要提取满足一定条件的元素的序列.就比如,一个树形结构,我把该接口拍扁成vector容器,每个节点都有一个惟一ID. 以下就是根据特定的ID查找节点下的子节 ...
- js判断当前移到浏览器版本
navigator.userAgent.match(/(iPhone|iPod|Android|ios)/i)
- SqlServer整库备份还原脚本
最近领导要求定时备份数据库(不是我的作业), 搜了一下资料还不少, 先mark一下, 得空再验证吧!!! 以下内容为转载 转自:https://www.cnblogs.com/want990/p/74 ...
- MATLAB 的循环语句
1.MATLAB while循环语法 在MATLAB 中 while循环的语法如下: while <expression> <statements> end while 循环反 ...
- Linux MySQL 4G内存my.cnf配置表(转)
# The following options will be passed to all MySQL clients[client]character-set-server = utf8 #### ...
- openstack neutron 二/三层网络实现
引用声明:https://zhangchenchen.github.io/2017/02/12/neutron-layer2-3-realization-discovry/ 一.概述 Neutron是 ...
- jquery.inputmask 输入框input输入内容格式限制插件
jQuery Input Mask plugin http://robinherbots.github.io/jquery.inputmask README.md jquery.inputmask C ...
- Java原理之HashMap
一下JDK1.7测试没问题,1.8就不一样了,应该散列的更优化. 最近看了很多java底层之HashMap的原理,根据自己的实现如下: package com.gmq.chapter02; impor ...
- Redis使用问题及知识点记录 - 待整理
介绍 官网:https://redis.io/commands/expire spring data redis 整合redis使用方法 spring 整合api :http://docs.sprin ...