【问题标题】:Not able to install requirements.txt and run the project on my local machine无法安装 requirements.txt 并在我的本地计算机上运行项目
【发布时间】:2021-11-14 18:27:55
【问题描述】:

Django 版本是1.7.1 python版本为3.9.2

嗨,Python/Django 开发人员! 我真的需要你的帮助,因为我在这些类型的错误中被困了一个星期。 我现在面临的问题是,当我尝试通过键入来安装要求时

pip install -r main_requirements.txt

它安装了大部分需求,但不安装这些包:

configobj
matplotlib
psycopg2
pysqlite
pyOpenSSL

unittest2
xgboost

当涉及到"configobj" 时,它会给出Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output. 的错误 安装matplotlib时也会出错 错误:

Using cached matplotlib-2.2.4.tar.gz (37.0 MB)
    ERROR: Command errored out with exit status 1:
     command: 'C:\Users\Dell\Documents\RashiedAmini\Nanaya_Web_Dev\venv\Scripts\python.exe' -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\Dell\\AppData\\Local\\Temp\\pip-install-ji91qscp\\matplotlib_fb7ae90f3d304658b27e8c23edc7e3b0\\setup.py'"'"'; __file__='"'"'C:\\Users\\Dell\\AppData\\Local\\Temp\\pip-install-ji91qscp\\matplotlib_fb7ae90f3d304658b27e8c23edc7e3b0\\setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');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-info-yzpvnump'
         cwd: C:\Users\Dell\AppData\Local\Temp\pip-install-ji91qscp\matplotlib_fb7ae90f3d304658b27e8c23edc7e3b0\
    Complete output (61 lines):
    ============================================================================
    Edit setup.cfg to change the build options

    BUILDING MATPLOTLIB
                matplotlib: yes [2.2.4]
                    python: yes [3.9.4 (tags/v3.9.4:1f2e308, Apr  6 2021,
                            13:40:21) [MSC v.1928 64 bit (AMD64)]]
                  platform: yes [win32]

    REQUIRED DEPENDENCIES AND EXTENSIONS
                     numpy: yes [not found. pip may install it below.]
          install_requires: yes [handled by setuptools]
                    libagg: yes [pkg-config information for 'libagg' could not
                            be found. Using local copy.]
                  freetype: no  [The C/C++ header for freetype
                            (freetype2\ft2build.h) could not be found.  You may
                            need to install the development package.]
                       png: no  [The C/C++ header for png (png.h) could not be
                            found.  You may need to install the development
                            package.]
                     qhull: yes [pkg-config information for 'libqhull' could not
                            be found. Using local copy.]

    OPTIONAL SUBPACKAGES
               sample_data: yes [installing]
                  toolkits: yes [installing]
                     tests: no  [skipping due to configuration]
            toolkits_tests: no  [skipping due to configuration]

    OPTIONAL BACKEND EXTENSIONS
                    macosx: no  [Mac OS-X only]
                    qt5agg: no  [PySide2 not found; PyQt5 not found]
                    qt4agg: no  [PySide not found; PyQt4 not found]
                   gtk3agg: no  [Requires pygobject to be installed.]
                 gtk3cairo: no  [Requires cairocffi or pycairo to be installed.]
                    gtkagg: no  [Requires pygtk]
                     tkagg: yes [installing; run-time loading from Python Tcl /
                            Tk]
                     wxagg: no  [requires wxPython]
                       gtk: no  [Requires pygtk]
                       agg: yes [installing]
                     cairo: no  [cairocffi or pycairo not found]
                 windowing: yes [installing]

    OPTIONAL LATEX DEPENDENCIES
                    dvipng: no
               ghostscript: no
                     latex: no
                   pdftops: no

    OPTIONAL PACKAGE DATA
                      dlls: no  [skipping due to configuration]

    ============================================================================
                            * The following required packages can not be built:
                            * freetype, png
                            * Please check http://gnuwin32.sourceforge.net/packa
                            * ges/freetype.htm for instructions to install
                            * freetype
                            * Please check http://gnuwin32.sourceforge.net/packa
                            * ges/libpng.htm for instructions to install png
    ----------------------------------------
WARNING: Discarding https://files.pythonhosted.org/packages/1e/20/2032ad99f0dfe0f60970941af36e8d0942d3713f442bb3df37ac35d67358/matplotlib-2.2.4.tar.gz#sha256=029620799e581802961ac1dcff5cb5d3ee2f602e0db9c0f202a90495b37d2126 (from https://pypi.org/simple/matplotlib/). Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

我的 main_requirements.txt 文件:

amqp==1.4.6
anyjson==0.3.3
autopep8==1.2.1
backports.functools-lru-cache==1.5
billiard==3.3.0.20
Bottleneck==1.2.1
celery
census==0.7
certifi==2018.11.29
chardet==3.0.4
colorama==0.2.5

cycler==0.10.0
dj-database-url==0.4.0
django==1.7.1
django-allauth==0.22.0
django-autocomplete-light==2.0.3
django-autoslug==1.7.2
django-cities-light==3.0.3
django-csvimport==2.4
django-datetime-widget==0.9.3
django-localflavor==1.1
django-mathfilters==0.3.0
django-pandas==0.6.0
django-rest-auth==0.7.0
django-widget-tweaks==1.3
djangorestframework==3.3.0
docutils==0.12
flake8==2.5.1
gevent==1.0
greenlet==0.4.2
gunicorn==17.5
html5lib==0.999
idna==2.8
importmagic==0.1.3
jedi==0.9.0
jellyfish==0.5.1
joblib==0.12.5
kiwisolver==1.0.1
kombu==3.0.26
lifelines==0.17.3
linecache2==1.0.0
lockfile==0.12.2

mccabe==0.3.1
numpy==1.9.1
oauthlib==0.6.3
pam==0.1.4
pandas==0.23.3
pep8==1.5.7
psutil==3.3.0

pydf==12
pyflakes==1.0.0


pyparsing==2.3.1
pyserial==2.6

python-daemon==2.1.0
python-dateutil==2.7.5
python-openid==2.2.5
pytz==2015.6
pyzipcode==0.4
requests==2.2.1
requests-oauthlib==0.4.2
rope==0.10.3
scikit-learn==0.20.0
scipy==1.2.0
sendgrid==1.2.0
setproctitle==1.1.9
six==1.10.0
sklearn==0.0
smtpapi==0.1.2
South==0.7.5
ssh-import-id==3.21
stripe==1.29.1
subprocess32==3.5.3
traceback2==1.4.0
Twisted==15.5.0
Unidecode==0.4.17

urllib3==1.7.1
us==0.9.1
virtualenv==1.11.4

xlrd==0.9.4
yapf==0.6.2
zope.interface==4.0.5
django-cachebuster==0.2.1
django-ipware==2.1.0
Whoosh==2.7.4



configobj
matplotlib
psycopg2
pysqlite
pyOpenSSL

unittest2
xgboost

【问题讨论】:

    标签: python python-2.7 virtualenv requirements.txt django-1.7


    【解决方案1】:

    看起来你的包在安装时依赖于其他包。 Pip 两次通过您的要求:首先它下载所有包并运行每个包的 setup.py 以获取其元数据,然后在第二遍中安装它们。

    这也是您在逐个安装软件包时看不到此错误的原因:如果您一次安装一个,则在您 pip install "your packages" 之前,您将完全安装在您的环境中。

    唯一的解决方案是在您运行 pip install -r requirements.txt 之前安装 pip install "" ——您将无法通过单个 requirements.txt 文件在单个命令中执行此操作。

    【讨论】:

    • 好吧,感谢您帮助我。我应该一个一个地安装所有的包吗?
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2018-06-17
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-12-27
    • 1970-01-01
    相关资源
    最近更新 更多