0%

Using a mirror to speed up Poetry installation

First, configure a global pip mirror:

1
pip config --user set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple

Then download the Poetry installer script locally, for example as install-poetry.py:

1
curl -sSL https://install.python-poetry.org -o install-poetry.py

Open the script and find this function:

1
2
def pip(self, *args, **kwargs) -> subprocess.CompletedProcess:
return self.python("-m", "pip", "--isolated", *args, **kwargs)

Remove "--isolated" from that call. After that, when the installer invokes pip, it will use the mirror you configured earlier.

Then run the installer:

1
python3 install-poetry.py
如果我的文字帮到了您,那么可不可以请我喝罐可乐?