如何解决Python-如何获取有关SyntaxError的更多信息?
我正在尝试在具有所有必需库的Ubuntu图像容器上运行Python代码。
Bootstrap: docker
From: ubuntu
%post
apt-get -y update
apt-get -y install python python3-pip curl
pip3 install scikit-learn cython numpy pydot keras torch torchvision
pip3 install matplotlib pandas plotly nltk seaborn scrapy gensim tensorflow xgboost textblob
pip3 install gym kaggle-environments stable-baselines3
我正在命令行中运行代码。当我运行简单的Hello World代码时,它可以工作。
cat hello.py | singularity exec connectx.simg /usr/bin/python
Hello World!
但是当我尝试运行需要各种库的另一个脚本时,出现了SyntaxError:
cat training3.py | singularity exec connectx.simg /usr/bin/python
File "<stdin>",line 26
def __init__(self,observation_space: gym.spaces.Box,features_dim: int = 512):
^
SyntaxError: invalid syntax
我不清楚是什么导致了SyntaxError。如何获得有关此错误的更多信息?
解决方法
尝试以下方法:
cat training3.py | singularity exec connectx.simg /usr/bin/python3
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。