安装 pip 在 python < 中不起作用3.6 [英] Installing pip is not working in python < 3.6
问题描述
我开始使用 bitbucket CI 制作应用程序,我正在使用以下步骤部署应用程序,但安装 pip 的步骤失败了.
I am starting to make a app using bitbucket CI and i am using the following steps to deploy the application and the steps to install pip is failing.
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
不知道为什么,但是 python get-pip.py
步骤失败并出现以下错误.
Dont know why but python get-pip.py
step fails with the following error.
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
直到昨天这一切都很好.不知道为什么这现在不起作用.
This worked fine upto yesterday. Not sure why this is not working now.
我认为这可能是因为 Windows,但我检查了运行 linux 的本地机器,但这些步骤但它们工作正常.
I thought it may be because of windows but i checked in my local machine running linux but these steps but they worked fine.
推荐答案
pip
21.0 不再支持 Python 2 和 3.5.更高版本需要 Python 3.6+.Python 支持语法 f""
3.6+.
pip
21.0 dropped support for Python 2 and 3.5. The later versions require Python 3.6+. The syntax f""
is supported by Python 3.6+.
要为 Python 2.7 安装 pip
,请从 https://bootstrap 安装.pypa.io/pip/2.7/ :
To install pip
for Python 2.7 install it from https://bootstrap.pypa.io/pip/2.7/ :
- 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,目前支持的最新版本是 pip
20.3.4.
The last command is to upgrade to the latest supported version. For Python 2.7 the latest supported is currently pip
20.3.4.
对于 Python 3.4 安装从 https://bootstrap.pypa.io/pip/3.4/一>.对于 Python 3.5 — https://bootstrap.pypa.io/pip/3.5/ .
For Python 3.4 install from https://bootstrap.pypa.io/pip/3.4/ . For Python 3.5 — https://bootstrap.pypa.io/pip/3.5/ .
对于 Python 3.4,升级命令是
For Python 3.4 the upgrade command is
- python -m pip install --upgrade "pip < 19.2"
这篇关于安装 pip 在 python < 中不起作用3.6的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!