在Django项目上未安装requirements.txt

时间:2020-06-26 05:54:56

标签: django

我是编程新手,这是我的第一个项目

尝试在服务器上启动Django项目

激活的虚拟环境

pip install -r requirements.txt命令之后,发生错误

 Exception:
    Traceback (most recent call last):
      File "/usr/lib/python2.7/dist-packages/pip/basecommand.py", line 215, in main
        status = self.run(options, args)
      File "/usr/lib/python2.7/dist-packages/pip/commands/install.py", line 353, in  run
        wb.build(autobuilding=True)
      File "/usr/lib/python2.7/dist-packages/pip/wheel.py", line 749, in build
        self.requirement_set.prepare_files(self.finder)
      File "/usr/lib/python2.7/dist-packages/pip/req/req_set.py", line 380, in prepa re_files
        ignore_dependencies=self.ignore_dependencies))
      File "/usr/lib/python2.7/dist-packages/pip/req/req_set.py", line 554, in _prep are_file
        require_hashes
      File "/usr/lib/python2.7/dist-packages/pip/req/req_install.py", line 278, in p opulate_link
        self.link = finder.find_requirement(self, upgrade)
      File "/usr/lib/python2.7/dist-packages/pip/index.py", line 465, in find_requir ement
        all_candidates = self.find_all_candidates(req.name)
      File "/usr/lib/python2.7/dist-packages/pip/index.py", line 423, in find_all_ca ndidates
        for page in self._get_pages(url_locations, project_name):
      File "/usr/lib/python2.7/dist-packages/pip/index.py", line 568, in _get_pages
        page = self._get_page(location)
      File "/usr/lib/python2.7/dist-packages/pip/index.py", line 683, in _get_page
        return HTMLPage.get_page(link, session=self.session)
      File "/usr/lib/python2.7/dist-packages/pip/index.py", line 795, in get_page
        resp.raise_for_status()
      File "/usr/share/python-wheels/requests-2.18.4-py2.py3-none-any.whl/requests/m odels.py", line 935, in raise_for_status
        raise HTTPError(http_error_msg, response=self)
    HTTPError: 404 Client Error: Not Found for url: https://pypi.org/simple/beatiful lsoup4/

3 个答案:

答案 0 :(得分:0)

您正在使用什么操作系统?确保正确安装了所有内容,使文件夹遵循官方文档或教程,并确保始终使用正确的环境,在该环境中已通过pip正确安装了Django(我使用pip3),请确保之前具有最新版本支持的Python版本(我使用3.8.2)和最新版本的pip。重新遍历所有段落,看看会发生什么。如果出现问题,请详细说明您的操作。

答案 1 :(得分:0)

好了,通过观察您的问题,我发现requirements.txt文件的beautifulsoup4库中有一个拼写错误,并且在提到的注释中,您在安装Django时也遇到了错误

Could not find a version that satisfies the requirement Django==2.0.7 (from -r requirements.txt (line 3)) (from versions: (any versions) .No matching distribution found for Django==2.0.7 –

Django 2以上版本仅支持python3,因此请尝试

pip3 install django==2.0.7

如果您的系统中装有python3.5及更高版本

也可以通过点子查看受支持的版本:

pip install django==0

pip3 install django==0

确保您没有使用vpn。

答案 2 :(得分:0)

再次解决您的问题,我发现2.0.7确实是正确的版本。 但是在您的requirements.txt中,其文字为Django==2.0.7应该是django==2.0.7