使用阿里云源加速 pip 安装包 | ATLASSC.NET
Skip to main content
/// .DATA.FRAGMENT_20240106

使用阿里云源加速 pip 安装包

1 minAuthor: Z.SHINCHVEN

使用 pip 使用阿里云的源,可以通过以下两种方法:

方法一:使用 pip 命令行参数

在使用 pip 命令安装包时,可以使用 -i 参数指定源地址。例如,要使用阿里云源安装包,可以使用以下命令:

pip install -i https://mirrors.aliyun.com/pypi/simple/ package_name

例如,要安装 pandas 包,可以使用以下命令:

pip install -i https://mirrors.aliyun.com/pypi/simple/ pandas

方法二:修改 pip 配置文件

也可以修改 pip 配置文件来设置源地址。在 Linux 和 macOS 系统中,pip 配置文件位于 ~/.pip/pip.conf 文件中。在 Windows 系统中,pip 配置文件位于 %APPDATA%\pip\pip.ini 文件中。

要使用阿里云源,需要在配置文件中添加以下内容:

[global]
index-url = https://mirrors.aliyun.com/pypi/simple/

例如,在 Linux 或 macOS 系统中,可以使用以下命令修改配置文件:

echo "[global]" >> ~/.pip/pip.conf
echo "index-url = https://mirrors.aliyun.com/pypi/simple/" >> ~/.pip/pip.conf

在 Windows 系统中,可以使用以下命令修改配置文件:

echo "[global]" > %APPDATA%\pip\pip.ini
echo "index-url = https://mirrors.aliyun.com/pypi/simple/" >> %APPDATA%\pip\pip.ini
RackNerd Billboard Banner
Share node:
/// .RELATED.DATA_STREAMSShared tags

Related posts

Scanning_database_for_correlations…

/// .UPLINK.SUBSCRIBE

Keep your deck synced with every new transmission from ATLASSC.NET. Subscribe over RSS or Atom, or wire the whole archive straight into your AI assistant with the MCP server.