gnome-terminal 出错 ImportError: cannot import name '_gi'

系统:ubuntu17

装了python2.7.13, 之后陆续装了python3.5.3, python3.6.1

本来默认的python版本是2.7, 改为3.6后, 就出现gnome-terminal用不了的问题:

$ gnome-terminal
Traceback (most recent call last):
  File "/usr/bin/gnome-terminal", line 9, in <module>
    from gi.repository import GLib, Gio
  File "/usr/lib/python3/dist-packages/gi/__init__.py", line 42, in <module>
    from . import _gi
ImportError: cannot import name '_gi'

$ ls /usr/lib/python3/dist-packages/gi/
_constants.py                              _gobject     overrides           _signalhelper.py
docstring.py                               importer.py  _propertyhelper.py  types.py
_error.py                                  __init__.py  __pycache__
_gi_cairo.cpython-35m-x86_64-linux-gnu.so  module.py    pygtkcompat.py
_gi.cpython-35m-x86_64-linux-gnu.so        _option.py   repository

$ sudo cp _gi.cpython-35m-x86_64-linux-gnu.so _gi.cpython-36m-x86_64-linux-gnu.so
$ sudo cp _gi_cairo.cpython-35m-x86_64-linux-gnu.so _gi_cairo.cpython-36m-x86_64-linux-gnu.so

OK, 问题解决

已标记关键词 清除标记
相关推荐
pycharm远程连接spark集群,运行python文件其中包含from gensim import models,报错内容为: ``` ssh://root@10.1.48.211:22/usr/local/bin/python3 -u /usr/local/h/sparktest.py Traceback (most recent call last): File "/usr/local/h/sparktest.py", line 6, in <module> from gensim import models File "/usr/local/lib/python3.5/site-packages/gensim/__init__.py", line 5, in <module> from gensim import parsing, corpora, matutils, interfaces, models, similarities, summarization, utils # noqa:F401 File "/usr/local/lib/python3.5/site-packages/gensim/parsing/__init__.py", line 4, in <module> from .preprocessing import (remove_stopwords, strip_punctuation, strip_punctuation2, # noqa:F401 File "/usr/local/lib/python3.5/site-packages/gensim/parsing/preprocessing.py", line 42, in <module> from gensim import utils File "/usr/local/lib/python3.5/site-packages/gensim/utils.py", line 40, in <module> import scipy.sparse File "/usr/local/lib/python3.5/site-packages/scipy/__init__.py", line 156, in <module> from . import fft File "/usr/local/lib/python3.5/site-packages/scipy/fft/__init__.py", line 76, in <module> from ._basic import ( File "/usr/local/lib/python3.5/site-packages/scipy/fft/_basic.py", line 1, in <module> from scipy._lib.uarray import generate_multimethod, Dispatchable File "/usr/local/lib/python3.5/site-packages/scipy/_lib/uarray.py", line 27, in <module> from ._uarray import * File "/usr/local/lib/python3.5/site-packages/scipy/_lib/_uarray/__init__.py", line 114, in <module> from ._backend import * File "/usr/local/lib/python3.5/site-packages/scipy/_lib/_uarray/_backend.py", line 1, in <module> from typing import ( ImportError: cannot import name 'Type' ``` 请问如何解决
©️2020 CSDN 皮肤主题: 大白 设计师:CSDN官方博客 返回首页