为多个用户安装#

默认的 Anaconda 安装选项是“Just Me”,它会创建一个独立的 Anaconda 安装,该安装不会与同一系统上的其他用户共享。另一种选择是为所有用户安装。

如果您具有管理员访问权限,则可以选择为“所有用户”进行安装。对于多用户系统,您希望允许用户导入 Python 库并运行 Python 应用程序,这是一个不错的选择。

默认情况下,此选项不授予写入权限,因此用户将无法在基本环境中安装包。它允许管理员保护基本环境中的内容。如果基本环境中需要软件包,请从命令提示符将权限提升为 administrator,然后运行 install 命令。

  1. 下载最新的 Anaconda Distribution 安装程序

  2. 双击安装程序以启动。

  3. 单击 Next 继续。

  4. 阅读 Anaconda 的服务条款 (TOS) 并单击 I Agree

  5. All Users (所有用户) 选择一个安装(这需要计算机的管理员权限),然后单击 Next(下一步)。

  6. 单击 Yes 以允许安装程序对您的计算机进行更改。

  7. 选择用户可访问的目标文件夹。默认值为C:\ProgramData\Anaconda.

  8. 安装完成后,打开“计算机管理”,导航到“本地用户和组”。为您的 Anaconda 用户创建一个新组。将用户添加到这个新组 Anaconda-Users。

  9. 导航到您的 Anaconda 文件夹,然后右键单击并选择 租房.取消选中 Attributes: Read-only and save changes 的框。转到 Security 并单击 Edit。从那里,添加 Anaconda-Users 并设置权限。您的组将需要读取和写入权限。

注意

需要 sudo 访问权限。

  1. 安装 Anaconda

  2. 安装完成后,请执行以下作:

    #Create a new group
    sudo groupadd mygroup
    # Change the group ownership to "mygroup" on the entire directory where Anaconda is installed.
    # Replace /PATH/TO/ANACONDA/INSTALL with the actual path to your installed Anaconda file.
    sudo chgrp -R mygroup /PATH/TO/ANACONDA/INSTALL
    # Set read and write permission for the owner, root, and the mygroup only.
    # Replace /PATH/TO/ANACONDA/INSTALL with the actual path to your installed Anaconda file.
    sudo chmod 770 -R /PATH/TO/ANACONDA/INSTALL
    # Add users to a group. Replace <USERNAME> with the username of the user you are adding.
    sudo adduser <USERNAME> mygroup
    

添加到“mygroup”组的用户现在能够访问 Anaconda、安装包和创建环境。