首页 > 解决方案 > 错误:找不到满足 django-haystack==2.8.1 要求的版本

问题描述

我已经安装了python3.6.4和pipenv,我已经将我的项目git到centos7,我想安装项目依赖项并使用这样的代码

pipenv install --deploy --ignore-pipfile

但我得到这样的错误:

    Installing dependencies from Pipfile.lock (bd1720)...
  ??   ???????????????????????????????? 2/2 ? 00:00:00
An error occurred while installing django-haystack==2.8.1 --hash=sha256:8b54bcc926596765d0a3383d693bcdd76109c7abb6b2323b3984a39e3576028c! Will try again.
An error occurred while installing django-pure-pagination==0.3.0 --hash=sha256:02b42561b8afb09f1fb6ac6dc81db13374f5f748640f31c8160a374274b54713! Will try again.
Installing initially failed dependencies...
[InstallError]:   File "/usr/local/lib/python3.6/site-packages/pipenv/cli/command.py", line 253, in install
[InstallError]:       site_packages=state.site_packages
[InstallError]:   File "/usr/local/lib/python3.6/site-packages/pipenv/core.py", line 2063, in do_install
[InstallError]:       keep_outdated=keep_outdated
[InstallError]:   File "/usr/local/lib/python3.6/site-packages/pipenv/core.py", line 1312, in do_init
[InstallError]:       pypi_mirror=pypi_mirror,
[InstallError]:   File "/usr/local/lib/python3.6/site-packages/pipenv/core.py", line 900, in do_install_dependencies
[InstallError]:       retry_list, procs, failed_deps_queue, requirements_dir, **install_kwargs
[InstallError]:   File "/usr/local/lib/python3.6/site-packages/pipenv/core.py", line 796, in batch_install
[InstallError]:       _cleanup_procs(procs, failed_deps_queue, retry=retry)
[InstallError]:   File "/usr/local/lib/python3.6/site-packages/pipenv/core.py", line 703, in _cleanup_procs
[InstallError]:       raise exceptions.InstallError(c.dep.name, extra=err_lines)
[pipenv.exceptions.InstallError]: Collecting django-haystack==2.8.1
[pipenv.exceptions.InstallError]:   Using cached django-haystack-2.8.1.tar.gz (1.6 MB)
[pipenv.exceptions.InstallError]:     ERROR: Command errored out with exit status 1:
[pipenv.exceptions.InstallError]:      command: /home/lovers/.local/share/virtualenvs/HelloDjango-blog-tutorial-0FfZskE0/bin/python -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-g2z8fsa3/django-haystack_153569cf40b54d2ab06ebfd5ae6e2c25/setup.py'"'"'; __file__='"'"'/tmp/pip-install-g2z8fsa3/django-haystack_153569cf40b54d2ab06ebfd5ae6e2c25/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 /tmp/pip-pip-egg-info-4uisc3da
[pipenv.exceptions.InstallError]:          cwd: /tmp/pip-install-g2z8fsa3/django-haystack_153569cf40b54d2ab06ebfd5ae6e2c25/
[pipenv.exceptions.InstallError]:     Complete output (13 lines):
[pipenv.exceptions.InstallError]:     Traceback (most recent call last):
[pipenv.exceptions.InstallError]:       File "<string>", line 1, in <module>
[pipenv.exceptions.InstallError]:       File "/home/lovers/.local/share/virtualenvs/HelloDjango-blog-tutorial-0FfZskE0/lib/python3.8/site-packages/setuptools/__init__.py", line 18, in <module>
[pipenv.exceptions.InstallError]:         from setuptools.dist import Distribution
[pipenv.exceptions.InstallError]:       File "/home/lovers/.local/share/virtualenvs/HelloDjango-blog-tutorial-0FfZskE0/lib/python3.8/site-packages/_virtualenv.py", line 89, in exec_module
[pipenv.exceptions.InstallError]:         old(module)
[pipenv.exceptions.InstallError]:       File "/home/lovers/.local/share/virtualenvs/HelloDjango-blog-tutorial-0FfZskE0/lib/python3.8/site-packages/setuptools/dist.py", line 34, in <module>
[pipenv.exceptions.InstallError]:         from setuptools import windows_support
[pipenv.exceptions.InstallError]:       File "/home/lovers/.local/share/virtualenvs/HelloDjango-blog-tutorial-0FfZskE0/lib/python3.8/site-packages/setuptools/windows_support.py", line 2, in <module>
[pipenv.exceptions.InstallError]:         import ctypes
[pipenv.exceptions.InstallError]:       File "/usr/local/lib/python3.8/ctypes/__init__.py", line 7, in <module>
[pipenv.exceptions.InstallError]:         from _ctypes import Union, Structure, Array
[pipenv.exceptions.InstallError]:     ModuleNotFoundError: No module named '_ctypes'
[pipenv.exceptions.InstallError]:     ----------------------------------------
[pipenv.exceptions.InstallError]: WARNING: Discarding https://files.pythonhosted.org/packages/69/43/3e247b7b2134b48e9a53fb387e191e5e05b5f38f2faf78ca892097c2b441/django-haystack-2.8.1.tar.gz#sha256=8b54bcc926596765d0a3383d693bcdd76109c7abb6b2323b3984a39e3576028c (from https://pypi.org/simple/django-haystack/). Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
[pipenv.exceptions.InstallError]: ERROR: Could not find a version that satisfies the requirement django-haystack==2.8.1
[pipenv.exceptions.InstallError]: ERROR: No matching distribution found for django-haystack==2.8.1
ERROR: Couldn't install package: django-haystack
 Package installation failed...
  ?  ???????????????????????????????? 1/2 ? 00

标签: pythonpython-3.xinstallationpipdjango-haystack

解决方案


好的,当我尝试了这么多方法时,我找到了问题的解决方案。使用这样的代码 pipenv install -r requirements.txt --python 3.6 ,然后使用这样的推荐

pipenv shell
pipenv run

最后,再试一次

pipenv install --deploy --ignore-pipfile

它的措辞!


推荐阅读