1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
# DP: Set site-packages/dist-packages
--- a/Lib/site.py
+++ b/Lib/site.py
@@ -7,12 +7,18 @@
This will append site-specific paths to the module search path. On
Unix (including Mac OSX), it starts with sys.prefix and
sys.exec_prefix (if different) and appends
-lib/python<version>/site-packages as well as lib/site-python.
+lib/python3/dist-packages as well as lib/site-python.
On other platforms (such as Windows), it tries each of the
prefixes directly, as well as with lib/site-packages appended. The
resulting directories, if they exist, are appended to sys.path, and
also inspected for path configuration files.
+For Debian and derivatives, this sys.path is augmented with directories
+for packages distributed within the distribution. Local addons go
+into /usr/local/lib/python<version>/dist-packages, Debian addons
+install into /usr/lib/python3/dist-packages.
+/usr/lib/python<version>/site-packages is not used.
+
If a file named "pyvenv.cfg" exists one directory above sys.executable,
sys.prefix and sys.exec_prefix are set to that directory and
it is also checked for site-packages and site-python (sys.base_prefix and
@@ -303,10 +309,21 @@
if sys.platform in ('os2emx', 'riscos'):
sitepackages.append(os.path.join(prefix, "Lib", "site-packages"))
elif os.sep == '/':
+ if 'VIRTUAL_ENV' in os.environ:
+ sitepackages.append(os.path.join(prefix, "lib",
+ "python" + sys.version[:3],
+ "site-packages"))
+ sitepackages.append(os.path.join(prefix, "local/lib",
+ "python" + sys.version[:3],
+ "dist-packages"))
+ sitepackages.append(os.path.join(prefix, "lib",
+ "python3",
+ "dist-packages"))
+ # this one is deprecated for Debian
sitepackages.append(os.path.join(prefix, "lib",
- "python" + sys.version[:3],
- "site-packages"))
- sitepackages.append(os.path.join(prefix, "lib", "site-python"))
+ "python" + sys.version[:3],
+ "dist-packages"))
+ sitepackages.append(os.path.join(prefix, "lib", "dist-python"))
else:
sitepackages.append(prefix)
sitepackages.append(os.path.join(prefix, "lib", "site-packages"))
|