可以一一安装软件包,但不能使用pip install -r requirements.txt

麦可

我已经使用python 3.6建立了虚拟环境;requirements.txt:

alembic==0.9.9
blinker==1.4
chardet==3.0.4
click==6.7
Flask==1.0.2
Flask-Dance==0.14.0
Flask-DebugToolbar==0.10.1
Flask-Login==0.4.1
Flask-Migrate==2.1.1
Flask-OAuth==0.12
Flask-OAuthlib==0.9.4
Flask-SQLAlchemy==2.3.2
Flask-WTF==0.14.2
httplib2==0.11.3
idna==2.6
itsdangerous==0.24
Jinja2==2.10
lazy==1.3
Mako==1.0.7
MarkupSafe==1.0
oauth2==1.9.0.post1
oauthlib==2.0.7
python-dateutil==2.7.2
python-editor==1.0.3
requests==2.18.4
requests-oauthlib==0.8.0
six==1.11.0
SQLAlchemy==1.2.6
SQLAlchemy-Utils==0.33.2
urllib3==1.22
URLObject==2.4.3
Werkzeug==0.14.1
wincertstore==0.2
WTForms==2.1

有趣的是,我可以一个接一个地安装软件包,例如:

(mynewflaskenv) D:\pythonProject10>pip install alembic==0.9.9
Collecting alembic==0.9.9
  Using cached alembic-0.9.9.tar.gz (1.0 MB)
Collecting SQLAlchemy>=0.7.6
  Downloading SQLAlchemy-1.3.20-cp36-cp36m-win_amd64.whl (1.2 MB)
     |████████████████████████████████| 1.2 MB 2.2 MB/s
Collecting Mako
  Downloading Mako-1.1.3-py2.py3-none-any.whl (75 kB)
     |████████████████████████████████| 75 kB 5.1 MB/s
Collecting python-editor>=0.3
  Downloading python_editor-1.0.4-py3-none-any.whl (4.9 kB)
Collecting python-dateutil
  Using cached python_dateutil-2.8.1-py2.py3-none-any.whl (227 kB)
Collecting MarkupSafe>=0.9.2
  Downloading MarkupSafe-1.1.1-cp36-cp36m-win_amd64.whl (16 kB)
Collecting six>=1.5
  Using cached six-1.15.0-py2.py3-none-any.whl (10 kB)
Using legacy 'setup.py install' for alembic, since package 'wheel' is not installed.
Installing collected packages: SQLAlchemy, MarkupSafe, Mako, python-editor, six, python-dateutil, alembic
    Running setup.py install for alembic ... done
Successfully installed Mako-1.1.3 MarkupSafe-1.1.1 SQLAlchemy-1.3.20 alembic-0.9.9 python-dateutil-2.8.1 python-editor-1.0.4 six-1.15.0

但是,如果我使用pip install -r requirements.txt:

(mynewflaskenv) D:\pythonProject10>pip install -r requirements.txt
Collecting alembic==0.9.9
  Using cached alembic-0.9.9.tar.gz (1.0 MB)
Collecting blinker==1.4
  Using cached blinker-1.4.tar.gz (111 kB)
Collecting chardet==3.0.4
  Using cached chardet-3.0.4-py2.py3-none-any.whl (133 kB)
Collecting click==6.7
  Using cached click-6.7-py2.py3-none-any.whl (71 kB)
Collecting Flask==1.0.2
  Using cached Flask-1.0.2-py2.py3-none-any.whl (91 kB)
Collecting Flask-Dance==0.14.0
  Using cached Flask_Dance-0.14.0-py2.py3-none-any.whl (39 kB)
Collecting Flask-DebugToolbar==0.10.1
  Using cached Flask_DebugToolbar-0.10.1-py2.py3-none-any.whl (326 kB)
Collecting Flask-Login==0.4.1
  Using cached Flask-Login-0.4.1.tar.gz (14 kB)
Collecting Flask-Migrate==2.1.1
  Using cached Flask_Migrate-2.1.1-py2.py3-none-any.whl (13 kB)
Collecting Flask-OAuth==0.12
  Using cached Flask-OAuth-0.12.tar.gz (6.2 kB)
Collecting Flask-OAuthlib==0.9.4
  Using cached Flask-OAuthlib-0.9.4.tar.gz (34 kB)
Collecting Flask-SQLAlchemy==2.3.2
  Using cached Flask_SQLAlchemy-2.3.2-py2.py3-none-any.whl (16 kB)
Collecting Flask-WTF==0.14.2
  Using cached Flask_WTF-0.14.2-py2.py3-none-any.whl (14 kB)
Collecting httplib2==0.11.3
  Using cached httplib2-0.11.3.tar.gz (215 kB)
Collecting idna==2.6
  Using cached idna-2.6-py2.py3-none-any.whl (56 kB)
Collecting itsdangerous==0.24
  Using cached itsdangerous-0.24.tar.gz (46 kB)
Collecting Jinja2==2.10
  Using cached Jinja2-2.10-py2.py3-none-any.whl (126 kB)
Collecting lazy==1.3
  Using cached lazy-1.3.zip (15 kB)
Collecting Mako==1.0.7
  Using cached Mako-1.0.7.tar.gz (564 kB)
Collecting MarkupSafe==1.0
  Using cached MarkupSafe-1.0.tar.gz (14 kB)
    ERROR: Command errored out with exit status 1:
     command: 'd:\pythonproject10\mynewflaskenv\scripts\python.exe' -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\
dell\\AppData\\Local\\Temp\\pip-install-4wzmja7p\\markupsafe\\setup.py'"'"'; __file__='"'"'C:\\Users\\dell\\AppData\\Local\\Temp\\pip-in
stall-4wzmja7p\\markupsafe\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"
'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base 'C:\Users\dell\AppData\Local\Temp\pip-pip-egg-inf
o-vwktxwrl'
         cwd: C:\Users\dell\AppData\Local\Temp\pip-install-4wzmja7p\markupsafe\
    Complete output (5 lines):
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "C:\Users\dell\AppData\Local\Temp\pip-install-4wzmja7p\markupsafe\setup.py", line 6, in <module>
        from setuptools import setup, Extension, Feature
    ImportError: cannot import name 'Feature'
    ----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

(mynewflaskenv) D:\pythonProject10>pip install alembic==0.9.9
Collecting alembic==0.9.9
  Using cached alembic-0.9.9.tar.gz (1.0 MB)
Collecting SQLAlchemy>=0.7.6
  Downloading SQLAlchemy-1.3.20-cp36-cp36m-win_amd64.whl (1.2 MB)
     |████████████████████████████████| 1.2 MB 2.2 MB/s
Collecting Mako
  Downloading Mako-1.1.3-py2.py3-none-any.whl (75 kB)
     |████████████████████████████████| 75 kB 5.1 MB/s
Collecting python-editor>=0.3
  Downloading python_editor-1.0.4-py3-none-any.whl (4.9 kB)
Collecting python-dateutil
  Using cached python_dateutil-2.8.1-py2.py3-none-any.whl (227 kB)
Collecting MarkupSafe>=0.9.2
  Downloading MarkupSafe-1.1.1-cp36-cp36m-win_amd64.whl (16 kB)
Collecting six>=1.5
  Using cached six-1.15.0-py2.py3-none-any.whl (10 kB)
Using legacy 'setup.py install' for alembic, since package 'wheel' is not installed.
Installing collected packages: SQLAlchemy, MarkupSafe, Mako, python-editor, six, python-dateutil, alembic
    Running setup.py install for alembic ... done
Successfully installed Mako-1.1.3 MarkupSafe-1.1.1 SQLAlchemy-1.3.20 alembic-0.9.9 python-dateutil-2.8.1 python-editor-1.0.4 six-1.15.0

(mynewflaskenv) D:\pythonProject10>pip install -r requirements.txt
Requirement already satisfied: alembic==0.9.9 in d:\pythonproject10\mynewflaskenv\lib\site-packages (from -r requirements.txt (line 1))
(0.9.9)
Collecting blinker==1.4
  Using cached blinker-1.4.tar.gz (111 kB)
Collecting chardet==3.0.4
  Using cached chardet-3.0.4-py2.py3-none-any.whl (133 kB)
Collecting click==6.7
  Using cached click-6.7-py2.py3-none-any.whl (71 kB)
Collecting Flask==1.0.2
  Using cached Flask-1.0.2-py2.py3-none-any.whl (91 kB)
Collecting Flask-Dance==0.14.0
  Using cached Flask_Dance-0.14.0-py2.py3-none-any.whl (39 kB)
Collecting Flask-DebugToolbar==0.10.1
  Using cached Flask_DebugToolbar-0.10.1-py2.py3-none-any.whl (326 kB)
Collecting Flask-Login==0.4.1
  Using cached Flask-Login-0.4.1.tar.gz (14 kB)
Collecting Flask-Migrate==2.1.1
  Using cached Flask_Migrate-2.1.1-py2.py3-none-any.whl (13 kB)
Collecting Flask-OAuth==0.12
  Using cached Flask-OAuth-0.12.tar.gz (6.2 kB)
Collecting Flask-OAuthlib==0.9.4
  Using cached Flask-OAuthlib-0.9.4.tar.gz (34 kB)
Collecting Flask-SQLAlchemy==2.3.2
  Using cached Flask_SQLAlchemy-2.3.2-py2.py3-none-any.whl (16 kB)
Collecting Flask-WTF==0.14.2
  Using cached Flask_WTF-0.14.2-py2.py3-none-any.whl (14 kB)
Collecting httplib2==0.11.3
  Using cached httplib2-0.11.3.tar.gz (215 kB)
Collecting idna==2.6
  Using cached idna-2.6-py2.py3-none-any.whl (56 kB)
Collecting itsdangerous==0.24
  Using cached itsdangerous-0.24.tar.gz (46 kB)
Collecting Jinja2==2.10
  Using cached Jinja2-2.10-py2.py3-none-any.whl (126 kB)
Collecting lazy==1.3
  Using cached lazy-1.3.zip (15 kB)
Collecting Mako==1.0.7
  Using cached Mako-1.0.7.tar.gz (564 kB)
Collecting MarkupSafe==1.0
  Using cached MarkupSafe-1.0.tar.gz (14 kB)
    ERROR: Command errored out with exit status 1:
     command: 'd:\pythonproject10\mynewflaskenv\scripts\python.exe' -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\
dell\\AppData\\Local\\Temp\\pip-install-lkdxc8hu\\markupsafe\\setup.py'"'"'; __file__='"'"'C:\\Users\\dell\\AppData\\Local\\Temp\\pip-in
stall-lkdxc8hu\\markupsafe\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"
'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base 'C:\Users\dell\AppData\Local\Temp\pip-pip-egg-inf
o-fg4ekrqp'
         cwd: C:\Users\dell\AppData\Local\Temp\pip-install-lkdxc8hu\markupsafe\
    Complete output (5 lines):
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "C:\Users\dell\AppData\Local\Temp\pip-install-lkdxc8hu\markupsafe\setup.py", line 6, in <module>
        from setuptools import setup, Extension, Feature
    ImportError: cannot import name 'Feature'
    ----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

从需求文件安装一个类似Pip的google失败,但是一个接一个地安装类似问题,但是错误术语不同,并且无法解决。我想知道有人可以分享一些解决方案,其他人也可能有这个问题吗?

赛特

这是因为依赖性相互冲突。一一安装,您实际上最终会安装不同(冲突的)版本。

注意:

  Downloading MarkupSafe-1.1.1-cp36-cp36m-win_amd64.whl (16 kB)

但是您的要求有 MarkupSafe==1.0

您最好的选择很可能是在你只引脚的版本requirements.txt,你知道你需要的特定版本。尝试取消固定或使用< <= >>=而不是==在可能地方。

还值得注意pip的是,就冲突依赖关系而言,的行为正在发生变化。因此,您所使用的pip版本也很重要。请务必升级点子。

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章

无法使用“pip install -r requirements.txt”安装需求

不失败的Pip Install -r requirements.txt

等价于Cabal的“ pip install -U -r requirements.txt”?

`pip install --upgrade -r requirements.txt` 与冻结的模块版本

'RUN pip install -r requirements.txt'不起作用

运行 pip install -r requirements.txt 时出错

从puppet pip install -r requirements.txt吗?

在Python中,`pip -r requirements.txt'不会*递归*安装软件包?

安装软件包并使用pip写入requirements.txt

安装软件包并使用pip写入requirements.txt

在安装需求之前,`pip install -U pip -r requirements.txt`是否会升级pip?

pip install -r requirements.txt在使用venv而不是Anaconda python时引发错误

无法使用pip install requirements.txt安装

使用“ conda install --yes --file requirements.txt”仅安装可用的软件包,而不会出现错误

dockerfile pip install -r requirements.txt 给出文件未找到错误

升级解释器后,`pip install -r requirements.txt`安全吗?

pip install -r requirements.txt错误,即使在正确的路径下

使用requirements.txt安装python软件包

如何在 Google Cloud Platform、App Engine 中执行 pip install -r requirements.txt(不使用 Gitlab CI)?

如何根据本地目录中的requirements.txt文件使用pip安装软件包?

如何根据本地目录中的requirements.txt文件使用pip安装软件包?

如何根据本地目录中的requirements.txt文件使用pip安装软件包?

AWS Elastic Beanstalk无法使用requirements.txt Git Pip安装Python软件包

我应该在Git存储库中还是专用的父目录中运行“ pip install -r requirements.txt”?

安装requirements.txt

从github repo中的requirements.txt安装软件包

如何通过Requirements.txt安装.zip软件包?

从requirements.txt安装选定的软件包

无法安装。点安装-r requirements.txt