Mike IT Mike IT - 1 year ago 87
Python Question

Django cannot be installed on virtual environment. (permission)

I like to install django on virtual-env I get the following error.

I am just curios why it is trying to change things under /usr/local/lib/python2.7/dist-packages/django.

Thank you in advance. Your help is much appreciated and voted.


(env) mike@mike-VirtualBox:~/Desktop/work/django/estore$ pip install django
Collecting django
Using cached Django-1.10.3-py2.py3-none-any.whl
Installing collected packages: django
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/pip/basecommand.py", line 215, in main
status = self.run(options, args)
File "/usr/local/lib/python2.7/dist-packages/pip/commands/install.py", line 342, in run
File "/usr/local/lib/python2.7/dist-packages/pip/req/req_set.py", line 784, in install
File "/usr/local/lib/python2.7/dist-packages/pip/req/req_install.py", line 851, in install
self.move_wheel_files(self.source_dir, root=root, prefix=prefix)
File "/usr/local/lib/python2.7/dist-packages/pip/req/req_install.py", line 1064, in move_wheel_files
File "/usr/local/lib/python2.7/dist-packages/pip/wheel.py", line 345, in move_wheel_files
clobber(source, lib_dir, True)
File "/usr/local/lib/python2.7/dist-packages/pip/wheel.py", line 316, in clobber
File "/usr/local/lib/python2.7/dist-packages/pip/utils/__init__.py", line 83, in ensure_dir
File "/usr/lib/python2.7/os.py", line 157, in makedirs
mkdir(name, mode)
OSError: [Errno 13] Permission denied: '/usr/local/lib/python2.7/dist-packages/django'

Answer Source

Try calling pip from bin folder of the env you create see if that works (below). Did you define an alias for pip command.

$ ./env/bin/pip install django
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download