python解释器出错,Python:“错误的解释器:没有这样的文件或目录”当运行django-admin.py...

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 !

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值