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 ...
随机推荐
- ios中图层的ancorPoint
@interface MJViewController () { CALayer *_layer; } @end @implementation MJViewController - (void)vi ...
- Inside NGINX: How We Designed for Performance & Scale
NGINX leads the pack in web performance, and it’s all due to the way the software is designed. Where ...
- html锚点定位不准确问题
问题描述 当顶部固定时,点击锚点,会跳转到锚点以下. <style> #one,#two,#three{ height: 500px; } #top{ position: fixed; h ...
- 获取可用的处理器(CPU)核数【转】
linux下获取cpu核数,sysconf(_SC_NPROCESSORS_CONF),,, from:红黑联盟,https://www.2cto.com/kf/201210/164480.html ...
- 有关于malloc申请内存和free内存释放
malloc工作机制: malloc函数的实质体现在,它有一个将可用的内存块连接为一个长长的列表的所谓空闲链表(堆内存).调用malloc函数时,它沿连接表寻找一个大到足以满足用户请求所需要的内存块. ...
- python中,花括号,中括号,小括号的区别
python中,花括号,中括号,小括号的区别 Python主要有三种数据类型:字典.列表.元组.其分别由花括号,中括号,小括号表示. 如: 字典:dic={'a':12,'b':34} 列表:list ...
- 第2章 Python基础-字符编码&数据类型 字符编码&字符串 练习题
1.简述位.字节的关系 位(bit)是计算机中最小的表示单元,数据传输是以“位”为单位的,1bit缩写为1b 字节(Byte)是计算机中最小的存储单位,1Byte缩写为1B 8bit = 1Byte ...
- Python 爬虫实例(13) 下载 m3u8 格式视频
Python requests 下载 m3u8 格式 视频 最近爬取一个视频网站,遇到 m3u8 格式的视频需要下载. 抓包分析,视频文件是多个 ts 文件,什么是 ts文件,请去百度 ...
- Oracle多表关联如何更新多个字段
注意点:1.被update主表一定要加上过滤条件.2.查询出来更新结果集,同时也要作为被更新主表的条件,作为同步大家都是更新这部分数据.update student stu set (stu.name ...
- Ingress 原理及实例
什么是Ingress 在Kubernetes中,Service和Pod的IP地址只能在集群内部网络中路由,所有到达“边界路由器”(Edge Router)的网络流量要么被丢弃,要么被转发到别处,从概念 ...