我刚刚创建了一个新的django项目,将其推送到git,现在我正尝试使用Digital ocean进行部署。
我安装了所有必要的东西,例如pip,python等,但无法使python manage.py runserver
工作。
((g-v)是我的virtualenv,所以这不是问题。)
它抛出此错误:
(g-v) root@ubuntu-s-4vcpu-8gb-blr1-01:/home/g-v/src# python manage.py runserver
File "manage.py", line 14
) from exc
^
SyntaxError: invalid syntax
我读了一些建议尝试python3 manage.py runserver
的帖子,但是当我尝试这样做时,出现此错误:
(g-v) root@ubuntu-s-4vcpu-8gb-blr1-01:/home/g-v/src# python3 manage.py runserver
-bash: /home/g-v/bin/python3: cannot execute binary file: Exec format error
我的pip list
命令输出:
(g-v) root@ubuntu-s-4vcpu-8gb-blr1-01:/home/g-v/src# pip list
DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support
Package Version
----------------------------- ----------
astroid 1.6.6
autopep8 1.4.4
backports.functools-lru-cache 1.5
certifi 2019.6.16
configparser 3.7.4
Django 1.11.23
enum34 1.1.6
futures 3.2.0
isort 4.3.21
lazy-object-proxy 1.4.1
mccabe 0.6.1
pip 19.2.2
pipenv 2018.11.26
pkg-resources 0.0.0
pycodestyle 2.5.0
Pygments 2.4.2
pylint 1.9.4
pytz 2019.2
setuptools 41.1.0
singledispatch 3.4.0.3
six 1.12.0
typing 3.7.4
virtualenv 16.7.3
virtualenv-clone 0.5.3
wheel 0.33.6
wrapt 1.11.2
答案 0 :(得分:0)
当我忘记转动venv时,发现了这样的错误。
尝试source ./path-to-venv/bin/activate
,然后再尝试manage.py runserver
命令。