![](/img/trans.png)
[英]AWS Batch:/usr/local/bin/python: cannot execute binary file
[英]bin/python3: cannot execute binary file: Exec format error
我剛剛創建了一個新的django項目,並將其推送到git,現在我正嘗試使用Digital ocean進行部署。
我安裝了所有需要的東西,例如pip,python等。但是我無法使python manage.py runserver
工作。
((gv)是我的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
當我忘記轉動venv時,我發現了這樣的錯誤。
嘗試使用source ./path-to-venv/bin/activate
然后再試一次manage.py runserver
命令。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.