私有包#
注意
个人付费计划与私有包是Anaconda.org的遗留服务,现已不再提供。然而,过去拥有私有包的用户仍然可以继续私有托管这些包。
将包设为私有#
默认情况下,所有上传到Anaconda.org的包都可以被任何有权访问该仓库的人访问。
注意
截至2023年8月30日,只有付费计划的用户才能将其包标记为私有。
要将上传到Anaconda.org上您的用户频道的包标记为私有:
选择所需的包。
导航到设置标签。
在侧边栏中选择Admin。
选择私有。
注意
其他Anaconda.org用户可以通过令牌或登录访问您的私有包。
使用令牌访问私有包#
令牌是一个随机的字母数字字符串,用于限制和提供对频道上包的访问。
为了使您的私有包可以通过令牌访问,请创建一个包含以下范围的访问token,用于Anaconda Client:
conda:download
或者,在anaconda.org上进行调整:在访问设置中,选择允许从conda仓库进行私有下载。
使用令牌访问私有包#
如果您打算从私有频道安装许多包,您可以将频道包含在您的.condarc
文件中。这将包括每次您在该频道上搜索包时的令牌。要从Anaconda Prompt(在macOS/Linux上是Terminal)将用户频道添加到您的.condarc
文件中,请运行以下命令:
# Replace <TOKEN> with the provided token
# Replace <CHANNEL> with a user channel
conda config --add channels https://conda.anaconda.org/t/<TOKEN>/<CHANNEL>
你也可以使用令牌来安装包,而无需先将频道添加到你的.condarc
文件中,通过使用频道的完整URL。在Anaconda Prompt(macOS/Linux上的终端)中,运行以下命令:
# Replace <TOKEN> with the provided token
# Replace <CHANNEL> with a user channel
# Replace <PACKAGE> with the name of the package you want to install
conda install --channel https://conda.anaconda.org/t/<TOKEN>/<CHANNEL> <PACKAGE>
访问带有标签的私有包#
使用令牌和标签名称从频道安装包:
# Replace <TOKEN> with the provided token
# Replace <CHANNEL> with a user channel
# Replace <LABEL_NAME> with the label name
# Replace <PACKAGE> with the name of the package you want to install
conda install --channel https://conda.anaconda.org/t/<TOKEN>/<CHANNEL>/label/<LABEL_NAME> <PACKAGE>
使用令牌访问私有PyPI包#
私有 PyPI 包也可以在网页界面中安装:
# Replace <TOKEN> with the provided token # Replace <CHANNEL> with a user channel https://pypi.anaconda.org/t/<TOKEN>/<CHANNEL>
作为注册用户访问私有包#
为了使您的私有包对已登录的用户可用:
创建一个组织。
在该组织中创建一个组(可以是只读的)。
将所需的用户添加到组中。
将包上传到组织,或将现有包转移到组织。
在您授予用户访问权限后,其他用户可以通过Web界面或Anaconda客户端安装您的包。
安装一个包:
在浏览器中,导航到所需的频道。
打开 Anaconda 提示符(在 macOS/Linux 上为终端)并运行以下命令:
# Replace <ORGANIZATION> with the organization name # Replace <PACKAGE> with the package name conda install anaconda-client anaconda login conda install --channel https://conda.anaconda.org/<ORGANIZATION> <PACKAGE>