Reputation: 159
I updated from Django 1.5.8 to 1.7:
pip install Django==1.7
Downloading/unpacking Django==1.7
Downloading Django-1.7-py2.py3-none-any.whl (7.4MB): 7.4MB downloaded
Installing collected packages: Django
Found existing installation: Django 1.5.8
Uninstalling Django:
Successfully uninstalled Django
Rolling back uninstall of Django
Cleaning up...
Exception:
Traceback (most recent call last):
File "/Library/Python/2.7/site-packages/pip-1.5.6-py2.7.egg/pip/basecommand.py", line 122, in main
status = self.run(options, args)
File "/Library/Python/2.7/site-packages/pip-1.5.6-py2.7.egg/pip/commands/install.py", line 283, in run
requirement_set.install(install_options, global_options, root=options.root_path)
File "/Library/Python/2.7/site-packages/pip-1.5.6-py2.7.egg/pip/req.py", line 1435, in install
requirement.install(install_options, global_options, *args, **kwargs)
File "/Library/Python/2.7/site-packages/pip-1.5.6-py2.7.egg/pip/req.py", line 671, in install
self.move_wheel_files(self.source_dir, root=root)
File "/Library/Python/2.7/site-packages/pip-1.5.6-py2.7.egg/pip/req.py", line 901, in move_wheel_files
pycompile=self.pycompile,
File "/Library/Python/2.7/site-packages/pip-1.5.6-py2.7.egg/pip/wheel.py", line 247, in move_wheel_files
clobber(source, dest, False, fixer=fixer, filter=filter)
File "/Library/Python/2.7/site-packages/pip-1.5.6-py2.7.egg/pip/wheel.py", line 209, in clobber
shutil.copy2(srcfile, destfile)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 130, in copy2
copyfile(src, dst)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 83, in copyfile
with open(dst, 'wb') as fdst:
IOError: [Errno 13] Permission denied: '/usr/local/bin/django-admin.py'
Storing debug log for failure in /Users/stefanieness/Library/Logs/pip.log
This is my error message.
But when I run
python
import django
print(django.get_version())
I get 1.7. Can I use the version like that or do I have to reinstall it? Will it work?
Thank you!
Upvotes: 2
Views: 5699
Reputation: 174624
This is because the first time you installed django, you did sudo pip install django
, which has installed django in your global Python interpreter as the root user (or the superuser).
You can only have one version of django in your global Python interpreter, so once you upgrade it, any of your django applications that are using the global Python interpreter (in other words, not using a virtual environment) will be automatically upgraded to 1.7
If you don't have any other django projects, then this doesn't really have any negative effects - but as a best practice, you should use virtual environments so that you can easily test versions of libraries.
To solve your immediate problem, you need to sudo pip install -U django
which will upgrade django to the latest stable release.
Upvotes: 4