在Python的pip中,你可以通过设置一个环境变量`PIP_INDEX_URL`来指定一个镜像源。对于清华大学提供的PyPI镜像,你可以使用以下命令来设置:
export PIP_INDEX_URL=https://pypi.tuna.tsinghua.edu.cn/simple
然后,你可以继续执行你的pip命令来安装依赖:
python3 -m pip install -U -r "/var/www/OceanXECM/requirements.txt"
将这两行命令组合在一起,你可以使用以下命令:
export PIP_INDEX_URL=https://pypi.tuna.tsinghua.edu.cn/simple && python3 -m pip install -U -r "/var/www/OceanXECM/requirements.txt"
这条命令首先会设置`PIP_INDEX_URL`环境变量,然后使用这个变量来从清华大学的PyPI镜像安装依赖。
注意:这种方式只在当前的shell会话中有效。如果你希望这个设置在系统重启或新的shell会话中仍然有效,你需要将`export PIP_INDEX_URL=https://pypi.tuna.tsinghua.edu.cn/simple`这行命令添加到你的bash配置文件(如`~/.bashrc`或`~/.bash_profile`)中。