python - 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
你好世界!
但是当我尝试运行另一个需要各种库的脚本时,我得到了 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
推荐阅读
- python - 预处理脚本不删除标点符号
- html - 如何不加载 Index.html?
- python-3.x - AttributeError:模块“tensorflow.python.keras.api._v2.keras.backend”没有属性“set_image_dim_ordering”
- java - 在 Spring Boot 中运行 Junit 测试用例时的初始化
- tensorflow - self_adjoint_eig 的问题
- google-cloud-firestore - 集合查询(单个)是否比 groupCollection 查询更快?
- c - 分配乘法表的问题
- javascript - Pixi.js - 窗口调整大小后重新定位元素
- azure-functions - 在 Azure Function 中添加自定义遥测属性
- javascript - nodemon 包未安装在 nodejs 中