I've googled the hell out of this, but all of the solutions I've found seem to solve problems that are not mine.
I created a project in a virtual environment in /Users/[user]/Documents/projects/[project] using virtualenv and installed Django.
Later, I deleted that project and installed Django on my system outside of the virtual environment. Now, I am trying to run this:
django-admin.py startproject mysite
However, I am receiving this error message:
-bash: /usr/local/bin/django-admin.py:
/Users/[user]/Documents/projects/[project]/bin/python:
bad interpreter: No such file or directory
I have found that the only way I can make this work again is by setting up the [project] virtual environment as I had it before with Django installed in it.
How do I fix this?
解决方案
I'm not sure how you did to produce this error, but the fix for you is to change /usr/local/bin/django-admin.py shebang to #!/usr/bin/env python.
Actually if you install django in a virtualenv the django-admin.py will have the shebang set to the python interpreter of your virtualenv, but this script will not be created in /usr/local/bin/ instead it will be created in //bin/ along with activate and the virtualenv python interpreter which is what confuse me, unless you moved it there !