為啥Windows中 Python目錄下含要有一個site-packages 檔案夾呢?
On Windows platforms, the default setting for sys.path does not
include a directory suitable for users to install locally
developed modules.
The "expected" location appears to be the
directory containing
the Python executable itself. This is also
the location where distutils
(and distutils-generated installers)
installs packages.
Including locally developed code in the same
directory as installed executables is not good practice.
官方解釋:
The standard Python distribution includes a directory
Lib/site-packages, which is used on Unix platforms to hold
locally-installed modules and packages. The site.py module
distributed with Python includes support for locating other
modules in the site-packages directory.
Motivation
On Windows platforms, the default setting for sys.path does not
include a directory suitable for users to install locally
developed modules.
The "expected" location appears to be the
directory containing
the Python executable itself. This is also
the location where distutils
(and distutils-generated installers)
installs packages.
Including locally developed code in the same
directory as installed executables is not good practice.
小銘版本:
因為Windows不像 Unix有一個folder (Lib/site-packages)放只有本機端安裝的python程式。
而且windows的 sys.path也沒有一個地方讓使用者能設定本地端安裝的python執行路徑。
最直接的地方是Python executable執行檔所放的地方。這也是用distutils 安裝其他python程式(packages)
會放的預定地。
但是若是把locally開發的程式也放在這路徑下並不是很好!
所以for Windows, 所有開發的新程式都會安裝在\Lib\site-package目錄下, 甚至是用distutils裝的新modules.
Powered by ScribeFire.
沒有留言:
張貼留言