[英]user site-package directory
I want to know how '~/.local/lib/python2.7/site-packages'
get into my ' sys.path'
. 我想知道'~/.local/lib/python2.7/site-packages'
进入我的' sys.path'
。
Is it defined by PEP 370 or modified by pip
(I install package with --user option)? 它是由PEP 370定义还是由pip
修改(我使用--user选项安装包)?
I also found out that this entry disappears if I move '~/.local/lib/python2.7/site-packages'
to '~/.local/lib/python2.7/site-packages.bak'
. 我还发现如果我将'~/.local/lib/python2.7/site-packages'
到'~/.local/lib/python2.7/site-packages.bak'
,这个条目就会消失。
I add this function Ad-hoc data breakpoints
to .pystartup
, but nothing changes. 我将此函数Ad-hoc data breakpoints
到.pystartup
,但没有任何更改。
Any one have any idea about this? 有谁对此有任何想法?
It comes via the site
module, which is imported by default by the interpreter unless you give it the -S
option. 它来自site
模块,默认情况下由解释器导入,除非您为其指定-S
选项。 (Do that, and you'll see it's no longer added, along with other things.) (那样做,你会看到它不再被添加,以及其他东西。)
Specifically, it's derived from the site
module's notion of a "user base" directory, which defaults to ~/.local
on POSIX systems. 具体来说,它源自site
模块的“用户库”目录的概念,默认为POSIX系统上的~/.local
。 That, in turn, is handled by the sysconfig
module, as the userbase
config variable. 反过来,它由sysconfig
模块作为userbase
配置变量处理。
See the documentation for the site
and sysconfig
modules for more details. 有关更多详细信息,请参阅site
和sysconfig
模块的文档。
The reason your data breakpoints don't work is probably just because site
is imported before your .pystartup
runs. 您的数据断点不起作用的原因可能仅仅是因为在运行.pystartup
之前导入了site
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.