我尝试运行此命令并收到错误
easy_install Django
(django-mike)zapbuild@jaskaran:~/Documents/python/django-mike$ easy_install Django
error: can't create or remove files in install directory
The following error occurred while trying to add or remove files in the
installation directory:
[Errno 13] Permission denied: '/home/zapbuild/Documents/python/django-mike/lib/python2.7/site-packages/test-easy-install-7107.write-test'
The installation directory you specified (via --install-dir, --prefix, or
the distutils default setting) was:
/home/zapbuild/Documents/python/django-mike/lib/python2.7/site-packages/
Perhaps your account does not have write access to this directory? If the
installation directory is a system-owned directory, you may need to sign in
as the administrator or "root" account. If you do not have administrative
access to this machine, you may wish to choose a different installation
directory, preferably one that is listed in your PYTHONPATH environment
variable.
For information on other options, you may wish to consult the
documentation at:
https://pythonhosted.org/setuptools/easy_install.html
Please make the appropriate changes for your system and try again.
答案1
假设您的问题是“如何安装 django?”,我可能会建议您使用pip
(python 的包管理器)进行安装。还有其他选择,但就我的经验而言,这种方法是最令人愉快的。
对于 python3,你可以使用以下命令安装 pip
sudo apt-get install python3-pip
如果您使用的是 python2,请将上面的命令更改python3-pip
为。python-pip
接下来,您应该升级 pip(使用 pip 进行升级)
sudo pip install --upgrade pip
笔记:上述命令中的第一个pip
可能需要改为pip-3.2
或其他变体。要找出pip
您需要的变体,请键入pip
,然后查看制表符补全建议。它将类似于pip
、pip3
、 或pip-3.2
(或其他版本号)。
现在您应该可以使用 pip 安装 django 了:
sudo pip install django
如果你的问题是“如何使用 安装 django easy_install
?”那么我很抱歉这个回答没有给你带来帮助。
答案2
除非你有充分的理由特别要求不同的版本,否则请从存储库安装 Django:
sudo apt-get update && sudo apt-get install python-django