Unable to work with Django (python 2.7, OS X 10.11.1) -
i'm pull hair out in frustration. trying start django project on new imac os x el capital. python 2.7 came installed on computer, , seems django. however, can't run django-admin. i've got django installed on laptop , didn't have trouble.
per official documentation, try
pip install --upgrade django==1.9.8
and terminal returns
requirement up-to-date: django==1.9.8 in /library/python/2.7/site-packages/django-1.9.8-py2.7.egg
then try in python:
>>> import django >>> print(django.get_version()) 1.9
great! next try:
django-admin.py --version
and returns
-bash: django-admin.py: command not found
after googling it, seems path may issue? try:
echo $path
and get
/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
on docs troubleshooting, "django-admin should on system path if installed django via python setup.py" try that.
sudo python setup.py install
a bunch of stuff happens, ,
extracting django-1.9.8-py2.7.egg /library/python/2.7/site-packages django 1.9.8 active version in easy-install.pth installing django-admin.py script /usr/local/bin error: [errno 2] no such file or directory: '/usr/local/bin/django-admin.py'
so in summary, seems django installed , can import , find version through python. however, cannot run django-admin.py or django-admin.
please help!!
try installing in virtualenv.
virtualenv -p /usr/bin/python2.7 venv # create virtual environment source venv/bin/activate # activate venv pip install --upgrade django==1.9.8 # install django in venv django-admin # should run django-admin venv
running in venv cleaner imo, allows have different projects using own venv without conflicting , can rid of venv when done deleting folder.
Comments
Post a Comment