django-admin startproject出错

时间:2016-06-26 05:56:07

标签: python django ubuntu

我试图使用" django-admin startproject sitedemo"来创建一个django项目。但是出现了以下错误

shivam@shivam-HP-15-Notebook-PC:~$ django-admin startproject sitedemo
Traceback (most recent call last):

 File "/usr/local/bin/django-admin", line 5, in <module>
    from pkg_resources import load_entry_point

  File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 3032, in <module>
    add_activation_listener(lambda dist: dist.activate())

  File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 933, in subscribe
    callback(dist)

  File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 3032, in <lambda>
    add_activation_listener(lambda dist: dist.activate())

  File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 2576, in activate
    for pkg in self._get_metadata('namespace_packages.txt'):

  File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 2566, in _get_metadata
    for line in self.get_metadata_lines(name):

  File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 1589, in get_metadata_lines
    return yield_lines(self.get_metadata(name))

  File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 1581, in get_metadata
    return self._get(self._fn(self.egg_info, name))

  File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line http://stackoverflow.com/editing-help1692, in _get
    with open(path, 'rb') as stream:
IOError: [Errno 13] Permission denied: '/usr/local/lib/python2.7/dist-packages/protobuf-3.0.0b3-py2.7.egg/EGG-INFO/namespace_packages.txt'

请帮我解决这些错误并在django中创建项目

1 个答案:

答案 0 :(得分:0)

好的!我认为你还没有先创建任何虚拟环境。 所以请首先为这个项目创建环境,如

virtualenv enviornment_name
cd enviornment_name
source bin/activate
cd  ..
django-admin.py startproject sitedemo