通过需求文件安装Flask 1.0.2,这些行引起了我的注意:
烧瓶1.0.2要求Jinja2> = 2.10,但您将拥有不兼容的jinja2 2.9.6。
烧瓶1.0.2要求Werkzeug> = 0.14,但您将拥有不兼容的werkzeug 0.12.2。
(stage) ivanleon@ilg40: ~/git/app $ pip3 install -r requirements.txt
Collecting APScheduler==3.4.0 (from -r requirements.txt (line 1))
Downloading https://files.pythonhosted.org/packages/df/61/77843aa045a2edd8375d15325ef70c174dfb3281c9112539384d61dc2a51/APScheduler-3.4.0-py2.py3-none-any.whl (57kB)
100% |████████████████████████████████| 61kB 415kB/s
Collecting Flask==1.0.2 (from -r requirements.txt (line 2))
Using cached https://files.pythonhosted.org/packages/7f/e7/08578774ed4536d3242b14dacb4696386634607af824ea997202cd0edb4b/Flask-1.0.2-py2.py3-none-any.whl
Collecting Jinja2==2.9.6 (from -r requirements.txt (line 3))
Downloading https://files.pythonhosted.org/packages/5e/73/10c45b82a88ed6b7751bd40da31eeefd7b362e07b56a99aa6e56655a0794/Jinja2-2.9.6-py2.py3-none-any.whl (340kB)
100% |████████████████████████████████| 348kB 1.0MB/s
Collecting MarkupSafe==1.0 (from -r requirements.txt (line 4))
Collecting Werkzeug==0.12.2 (from -r requirements.txt (line 5))
Downloading https://files.pythonhosted.org/packages/97/02/306e0d57fdbf467ec1c763bc1757ec6ba20b1332e0ea7e49111533d71d1c/Werkzeug-0.12.2-py2.py3-none-any.whl (312kB)
100% |████████████████████████████████| 317kB 379kB/s
Collecting bcrypt==3.1.3 (from -r requirements.txt (line 6))
Downloading https://files.pythonhosted.org/packages/bd/2e/fbb55cd6116b551adeb9144ffb263fc9280c18d97c693c19cfbb459e14d8/bcrypt-3.1.3-cp35-cp35m-manylinux1_x86_64.whl (54kB)
100% |████████████████████████████████| 61kB 441kB/s
Collecting cffi==1.11.0 (from -r requirements.txt (line 7))
Downloading https://files.pythonhosted.org/packages/01/cb/3f6c311f13e0e04a691c161ff5f2272304cc0e7fcd95500ea7848d5b3da5/cffi-1.11.0-cp35-cp35m-manylinux1_x86_64.whl (418kB)
100% |████████████████████████████████| 419kB 551kB/s
Collecting click==6.7 (from -r requirements.txt (line 8))
Using cached https://files.pythonhosted.org/packages/34/c1/8806f99713ddb993c5366c362b2f908f18269f8d792aff1abfd700775a77/click-6.7-py2.py3-none-any.whl
Collecting gunicorn==19.7.1 (from -r requirements.txt (line 9))
Downloading https://files.pythonhosted.org/packages/64/32/becbd4089a4c06f0f9f538a76e9fe0b19a08f010bcb47dcdbfbc640cdf7d/gunicorn-19.7.1-py2.py3-none-any.whl (111kB)
100% |████████████████████████████████| 112kB 575kB/s
Collecting itsdangerous==0.24 (from -r requirements.txt (line 10))
Collecting pycparser==2.18 (from -r requirements.txt (line 11))
Collecting pymongo==3.5.1 (from -r requirements.txt (line 12))
Downloading https://files.pythonhosted.org/packages/c4/27/604db138d80a0d24f8bd8dcfde88b46e121f1fa5e85b14783375306b866f/pymongo-3.5.1-cp35-cp35m-manylinux1_x86_64.whl (365kB)
100% |████████████████████████████████| 368kB 510kB/s
Collecting pytz==2017.2 (from -r requirements.txt (line 13))
Downloading https://files.pythonhosted.org/packages/55/62/e7cd0e15b76062d298413f14bb4ec3cd8568a22d274427f9c3c7286969f4/pytz-2017.2-py2.py3-none-any.whl (484kB)
100% |████████████████████████████████| 491kB 498kB/s
Collecting six==1.11.0 (from -r requirements.txt (line 14))
Downloading https://files.pythonhosted.org/packages/67/4b/141a581104b1f6397bfa78ac9d43d8ad29a7ca43ea90a2d863fe3056e86a/six-1.11.0-py2.py3-none-any.whl
Collecting tzlocal==1.4 (from -r requirements.txt (line 15))
Downloading https://files.pythonhosted.org/packages/db/53/1334a66eef27703f3bd14c9592f6468bc46ad4371b23bd9b7c25cece8f28/tzlocal-1.4.tar.gz
Requirement already satisfied: setuptools>=0.7 in /home/ivanlmj/envs/PyCaptive/lib/python3.5/site-packages (from APScheduler==3.4.0->-r requirements.txt (line 1)) (40.4.3)
Building wheels for collected packages: tzlocal
Running setup.py bdist_wheel for tzlocal ... done
Stored in directory: /home/ivanlmj/.cache/pip/wheels/af/9d/e0/2770c31f8abc240bf3aedcdda460410c7c7a6bb357504be488
Successfully built tzlocal
---> flask 1.0.2 has requirement Jinja2>=2.10, but you'll have jinja2 2.9.6 which is incompatible.
---> flask 1.0.2 has requirement Werkzeug>=0.14, but you'll have werkzeug 0.12.2 which is incompatible.
Installing collected packages: six, pytz, tzlocal, APScheduler, click, MarkupSafe, Jinja2, itsdangerous, Werkzeug, Flask, pycparser, cffi, bcrypt, gunicorn, pymongo
Successfully installed APScheduler-3.4.0 Flask-1.0.2 Jinja2-2.9.6 MarkupSafe-1.0 Werkzeug-0.12.2 bcrypt-3.1.3 cffi-1.11.0 click-6.7 gunicorn-19.7.1 itsdangerous-0.24 pycparser-2.18 pymongo-3.5.1 pytz-2017.2 six-1.11.0 tzlocal-1.4
(stage) ivanleon@ilg40: ~/git/app $ pip3 freeze
APScheduler==3.4.0
bcrypt==3.1.3
cffi==1.11.0
click==6.7
Flask==1.0.2
gunicorn==19.7.1
itsdangerous==0.24
Jinja2==2.9.6
MarkupSafe==1.0
pkg-resources==0.0.0
pycparser==2.18
pymongo==3.5.1
pytz==2017.2
six==1.11.0
tzlocal==1.4
Werkzeug==0.12.2
有人在安装最新版本的Flask时遇到过这种情况,并且知道如何解决此问题吗?
答案 0 :(得分:2)
Flask 1.0.2为其依赖项设置最低版本。您的requirements.txt
文件已将这些依赖关系固定到不兼容的版本。更新您的requirements.txt
文件。
具体来说,您的pip
输出:
Collecting Jinja2==2.9.6 (from -r requirements.txt (line 3))
[...]
Collecting Werkzeug==0.12.2 (from -r requirements.txt (line 5))
告诉您该文件中要更新的行。
错误消息告诉您最低版本是什么:
---> flask 1.0.2 has requirement Jinja2>=2.10, but you'll have jinja2 2.9.6 which is incompatible.
---> flask 1.0.2 has requirement Werkzeug>=0.14, but you'll have werkzeug 0.12.2 which is incompatible.
因此,您至少必须更改这些行以使用那些特定的最低版本的引脚。
我建议您避免为您的requirements.txt
文件中的每个软件包使用确切的版本图钉,而应仅图钉您最重要的顶级软件包。固定烧瓶,但不固定依赖项,然后将其保留给pip
,以查找这些依赖项的兼容版本;您可以完全从requirements.txt
文件中删除依赖性。
更好的是,切换到Pipenv而不是requirements.txt
文件,使用该文件指定顶级依赖项,并将固定依赖项版本保留为Pipenv
。这使您两全其美。一个配置文件来指定您自己的项目依赖项(Pipfile
),以及一个带有当前设置的固定版本的单独文件(Pipfile.lock
)。