我已经安装了 Django 1.4.3。然后当我使用 pip 升级 Django 时,我得到了这个错误。
$ pip install Django --upgrade
Downloading/unpacking Django from https://pypi.python.org/packages/source/D/Django/Django-1.5.2.tar.gz#md5=26e83e6394a15a86212777d5f61eae86
Running setup.py egg_info for package Django
warning: no previously-included files matching '__pycache__' found under directory '*'
warning: no previously-included files matching '*.py[co]' found under directory '*'
Installing collected packages: Django
Found existing installation: Django 1.4.3
Uninstalling Django:
Exception:
Traceback (most recent call last):
File "/Library/Python/2.7/site-packages/pip-1.3.1-py2.7.egg/pip/basecommand.py", line 139, in main
status = self.run(options, args)
File "/Library/Python/2.7/site-packages/pip-1.3.1-py2.7.egg/pip/commands/install.py", line 271, in run
requirement_set.install(install_options, global_options, root=options.root_path)
File "/Library/Python/2.7/site-packages/pip-1.3.1-py2.7.egg/pip/req.py", line 1181, in install
requirement.uninstall(auto_confirm=True)
File "/Library/Python/2.7/site-packages/pip-1.3.1-py2.7.egg/pip/req.py", line 495, in uninstall
paths_to_remove.remove(auto_confirm)
File "/Library/Python/2.7/site-packages/pip-1.3.1-py2.7.egg/pip/req.py", line 1518, in remove
renames(path, new_path)
File "/Library/Python/2.7/site-packages/pip-1.3.1-py2.7.egg/pip/util.py", line 293, in renames
shutil.move(old, new)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 296, in move
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 249, in rmtree
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 247, in rmtree
OSError: [Errno 13] Permission denied: '/Library/Python/2.7/site-packages/Django-1.4.3-py2.7.egg-info/dependency_links.txt'
当我试图卸载 Django 1.4.3 时,
$ pip uninstall django
我遇到了类似的错误。
当我安装 Django 1.4.3 时,我没有下载它。我只是使用 pip 并且它有效。然后我下载了 Django 1.5.2 并尝试升级,但没有成功。
这可能是个愚蠢的问题:为什么我不需要下载 Django 1.4.3 来安装它?而且我也无法弄清楚这个错误是什么意思。
在下载和安装时,我总是很困惑。我不完全理解终端发生了什么。
任何帮助表示赞赏。