且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

python,更改用户站点目录或使用--user安装setup.py --prefix

更新时间:2023-10-17 11:37:10

要回答第一个问题:

在Greg Ward编写的安装Python模块指南中,我们读到:

In Installing Python Modules guide written by Greg Ward we read:

请注意,各种备用安装方案是相互关联的 独占:您可以传递--user或--home或--prefix和 --exec-prefix或--install-base和--install-platbase,但您不能混用这些组.

Note that the various alternate installation schemes are mutually exclusive: you can pass --user, or --home, or --prefix and --exec-prefix, or --install-base and --install-platbase, but you can’t mix from these groups.

要回答第二个问题:

在同一指南中,有备用安装:用户方案,我们在其中阅读:

In the same guide there's section Alternate installation: the user scheme where we read:

文件将安装到site.USER_BASE

,其中site.USER_BASE链接到 https://docs.python. org/2/library/site.html#site.USER_BASE .要求我们在那里查看有关 PYTHONUSERBASE 环境的信息变量:

with site.USER_BASE linked to https://docs.python.org/2/library/site.html#site.USER_BASE. There we are asked to see also information on PYTHONUSERBASE environment variable:

定义用户基本目录,该目录用于计算以下内容的路径 用户site-packages目录和Distutils安装路径,用于 python setup.py install --user.

Defines the user base directory, which is used to compute the path of the user site-packages directory and Distutils installation paths for python setup.py install --user.

此外,您可能对家庭计划:

家庭计划"背后的想法是,您建立并维护一个 Python模块的个人存储.该方案的名称来源于 在Unix上使用主"目录的想法,因为对于 Unix用户使其主目录的布局类似于/usr/ 或/usr/local/.

The idea behind the "home scheme" is that you build and maintain a personal stash of Python modules. This scheme’s name is derived from the idea of a "home" directory on Unix, since it’s not unusual for a Unix user to make their home directory have a layout similar to /usr/ or /usr/local/.