pip install django error using virtualenv



>我已经设置了虚拟环境

(website) username[`/public_html/website]

/public_html/website目录中有 django 项目

当我尝试使用 pip install django 安装 django 时给出以下错误

Collecting django 
Could not find a version that satisfies the requirement django (from versions:)
No mathcing distribution for django

我已经尝试过which pip它提供了public_html/website/bin/pip

当我尝试python manage.py runserver给出错误couldnt import django

我应该如何在 virtualenv 中安装 django,然后运行服务器?

编辑

尝试时pip search django出现以下错误

HTTP error 403 while getting https://pypi.python.org/pypi
Exception:
Traceback (most recent call last):
  File "/home/siddhesh3186/public_html/website/env/lib/python3.4/site-packages/pip/basecommand.py", line 215, in main
    status = self.run(options, args)
  File "/home/siddhesh3186/public_html/website/env/lib/python3.4/site-packages/pip/commands/search.py", line 45, in run
    pypi_hits = self.search(query, options)
  File "/home/siddhesh3186/public_html/website/env/lib/python3.4/site-packages/pip/commands/search.py", line 62, in search
    hits = pypi.search({'name': query, 'summary': query}, 'or')
  File "/home/siddhesh3186/.local/lib/python3.4/xmlrpc/client.py", line 1098, in __call__
    return self.__send(self.__name, args)
  File "/home/siddhesh3186/.local/lib/python3.4/xmlrpc/client.py", line 1437, in __request
    verbose=self.__verbose
  File "/home/siddhesh3186/public_html/website/env/lib/python3.4/site-packages/pip/download.py", line 776, in request
    response.raise_for_status()
  File "/home/siddhesh3186/public_html/website/env/lib/python3.4/site-packages/pip/_vendor/requests/models.py", line 862, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
pip._vendor.requests.exceptions.HTTPError: 403 Client Error: Forbidden for url: https://pypi.python.org/pypi

这是我得到的错误

试试这个: pip search django .它显示了什么?

编辑:

尝试创建新的虚拟环境。如果问题仍然存在,请创建一个没有 pip 的虚拟环境使用 virtualenv --no-pip ,然后使用 get-pip.py 安装 PIP

最新更新