3.6
script: - apt-get update - apt-get install -y python-dev - curl -O https://bootstrap.pypa.io/get-pip.py - python get-pip.py ... and a few more steps嘗試在bitbucket CI使用以下步驟安裝pip時出現常見錯誤:
Traceback (most recent call last): File "get-pip.py", line 24226, in <module> main() File "get-pip.py", line 199, in main bootstrap(tmpdir=tmpdir) File "get-pip.py", line 82, in bootstrap from pip._internal.cli.main import main as pip_entry_point File "/tmp/tmpUgc5ng/pip.zip/pip/_internal/cli/main.py", line 60 sys.stderr.write(f"ERROR: {exc}") SyntaxError: invalid syntax錯誤表現為:
為什麼會這樣失敗?
如何解決問題
curl -O https://bootstrap.pypa.io/pip/2.7/get-pip.py python get-pip.py python -m pip install --upgrade "pip < 21.0"Python 2.7:從安裝https://bootstrap.pypa.io/ pip/2.7/
python -m pip install --upgrade "pip < 19.2"
以上是為什麼 pip 安裝在 Python < 3.6 上失敗以及如何修復它?的詳細內容。更多資訊請關注PHP中文網其他相關文章!