Skip to main content
 首页 » 编程设计

python之pip gmane 无法导入

2024年10月24日7youxin

我已经安装了 gmane,当然我已经运行了升级。

pip install gmane --upgrade 

然后它向我展示了那些:

'Requirement already up-to-date: gmane in ./lib/python2.7/site-packages'

>>> import gmane 

它向我显示了这些错误:

Traceback (most recent call last): 
  File "<stdin>", line 1, in <module> 
  File "/root/code/site/local/lib/python2.7/site-packages/gmane/__init__.py", line 26, in <module> 
    from .networkEvolution import NetworkEvolution 
  File "/root/code/site/local/lib/python2.7/site-packages/gmane/networkEvolution.py", line 9, in <module> 
    from .pca import * 
  File "/root/code/site/local/lib/python2.7/site-packages/gmane/pca.py", line 79 
    def __init__(self,*metrics,final_dimensions=2,draw=False): 
                                              ^ 
SyntaxError: invalid syntax 

有人帮忙吗?

请您参考如下方法:

我检查了错误,发现错误“语法错误”。所以我写了一个非常简单的示例来确认它。

class MyGmane: 
    def __init__(self,*meteris ,final_dimensions=2,draw=False): 
        pass 
 
if __name__ == '__main__': 
    mg = MyGmane() 

我收到以下错误:

python $python q.py  
  File "q.py", line 2 
    def __init__(self,*meteris ,final_dimensions=2,draw=False): 
                                           ^ 
SyntaxError: invalid syntax 

在我更改 init 方法中的顺序后,如下所示:

def __init__(self,final_dimensions=2,draw=False,*meteris): 

然后它工作了,所以我修改了这个文件(第 79 行)

"/root/code/site/local/lib/python2.7/site-packages/gmane/pca.py" It's also work, so i guess there are maybe have a bug on 'game'!