简体   繁体   English

Python anaconda def __init__(self, pad_result: tuple = None, width=0, height=0) 语法错误:无效语法

[英]Python Syntax error on anaconda def __init__(self, pad_result: tuple = None, width=0, height=0): invalid syntax

I am trying to run a code which had the following requirements that are already installed:我正在尝试运行已安装以下要求的代码:

tensorflow-gpu==1.4.1 ,scipy==1.0.0, opencv-python==3.3.0.10, numpy==1.11.0, Pillow==5.1.0, CUDA 8.0, Cudnn 6.0
def __init__(self, pad_result: tuple = None, width=0, height=0):

and I get an invalid syntax error I am running using anaconda and I tried a couple of different python versions(2.7, 3.6...) Is there a specific version to use or is it another problem?我得到一个无效的语法错误我正在使用 anaconda 运行,我尝试了几个不同的 python 版本(2.7、3.6...) 是否有特定版本可以使用,还是另一个问题?

This Python code is for Python 3.5 or newer, because there are type hints .此 Python 代码适用于 Python 3.5 或更高版本,因为有类型提示 Given that you're using a fairly old version of numpy (2016) I suspect that you're using a pre-3.5 Python interpreter as well.鉴于您使用的是相当旧版本的 numpy (2016),我怀疑您也在使用 3.5 之前的 Python 解释器。

Anaconda can be weird about changing the version of the Python interpreter. Anaconda 对于更改 Python 解释器的版本可能会很奇怪。 Double-check by仔细检查

import sys
print(sys.version)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM