Mac下python manage.py runsever 报错
Posted 今天一定早睡
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Mac下python manage.py runsever 报错相关的知识,希望对你有一定的参考价值。
macsn@MacsndeMac U_crawler % python manage.py runsever
Traceback (most recent call last):
File "manage.py", line 17, in <module> "Couldn‘t import Django. Are you sure it‘s installed and " ImportError: Couldn‘t import Django. Are you sure it‘s installed and available on your PYTHONPATH environment variable? Did you forget to activate a virtual environment?
这个问题纠结我一天,结果打开方式不对,?? ?? 辽~
/***我的错误示范:
出现这个问题,我首先想到Mac下自带python2.7,而我自己安装了一个python3.8,终端执行命令:which python 显示系统自带解析路径,于是我就想怎么把它改成自定义的路径,按照网上各路博客把环境变量bash_profile文件改了一通
but 依然不行,然后我就想一不做二不休,把python2.7删了,只剩下自己装的python3.8总可以了把,按照网上各路博客把删除Mac自带python2.7的终端代码执行了一通,然后macsn@MacsndeMac ~ % which python /usr/bin/python
macsn@MacsndeMac ~ % emmmmmmm 要疯辽 ,这边建议亲不要随便删除Mac自带的python呢,虽然版本低但是它系统对他依赖强啊
**/
正确打开方式:
python3 manage.py runserver
macsn@MacsndeMac U_crawler % python3 manage.py runserver Watching for file changes with StatReloader Performing system checks... System check identified no issues (0 silenced). You have 17 unapplied migration(s). Your project may not work properly until you apply the migrations for app(s): admin, auth, contenttypes, sessions. Run ‘python manage.py migrate‘ to apply them. May 23, 2020 - 02:49:17 Django version 3.0.6, using settings ‘U_crawler.settings‘ Starting development server at http://127.0.0.1:8000/ Quit the server with CONTROL-C.
对加个3就行了,pip指令没法用的时候pip3试试
Django要2.0以上
以上是关于Mac下python manage.py runsever 报错的主要内容,如果未能解决你的问题,请参考以下文章
Django的manage.py runserver 可以长期运行吗
为啥我在运行时出现整数精度错误:heroku run python manage.py migrate
执行 Run manage.py Task 报 AttributeError: 'Command' object has no attribute 'usage'?
运行“python manage.py syncdb”的“未知命令 syncdb”
初试django---python manage.py makemigrations以及python manage.py migrate