其他分享
首页 > 其他分享> > 14.04 – ImportError:无法导入名称_remove_dead_weakref

14.04 – ImportError:无法导入名称_remove_dead_weakref

作者:互联网

我已经尝试过四处寻找但是找不到一个好的修复或其他任何有这个特定错误的人.

我尝试使用apt-get安装屏幕安装屏幕后会发生这种情况.

错误:

Setting up python3.6-minimal (3.6.1-1~14.04.york0) ...
Traceback (most recent call last):
  File "/usr/lib/python3.6/py_compile.py", line 6, in <module>
    import importlib._bootstrap_external
  File "/usr/lib/python3.6/importlib/__init__.py", line 57, in <module>
    import types
  File "/usr/lib/python3.6/types.py", line 171, in <module>
    import functools as _functools
  File "/usr/lib/python3.6/functools.py", line 23, in <module>
    from weakref import WeakKeyDictionary
  File "/usr/lib/python3.6/weakref.py", line 12, in <module>
    from _weakref import (
ImportError: cannot import name '_remove_dead_weakref'
dpkg: error processing package python3.6-minimal (--configure):
 subprocess installed post-installation script returned error exit status 1
dpkg: dependency problems prevent configuration of python3.6:
 python3.6 depends on python3.6-minimal (= 3.6.1-1~14.04.york0); however:
  Package python3.6-minimal is not configured yet.

dpkg: error processing package python3.6 (--configure):
 dependency problems - leaving unconfigured
Errors were encountered while processing:
 python3.6-minimal
 python3.6
E: Sub-process /usr/bin/dpkg returned an error code (1)

运行Ubuntu 14.04.

屏幕本身似乎安装了它的最新版本,但错误信息仍让我担心.

在这里真的不知所措,非常感谢任何帮助.

解决方法:

我最近在Ubuntu 16.10上使用Pycharm 2017.3.2时遇到了这个问题.

我的设置是:

我从python PPA安装了Python 3.6.我有Python 3.6.0b4.但是,我刚刚将Ubuntu升级到17.04,但尚未重启.当我重新启动计算机时,仍然会抛出该错误.因此,我试着看看终端中默认的python3.6是什么.

➜  ~ python3.6
Python 3.6.1 (default, Mar 22 2017, 06:17:05) 
[GCC 6.3.0 20170321] on linux
Type "help", "copyright", "credits" or "license" for more information.

因此,我意识到我在virtualenv中使用的Python可能已过时或指向不正确的Python版本.

解:

>确保我安装了什么版本的Python 3.6(3.6.1).
>删除了我的虚拟环境.
>使用virtualenvwrapper创建新的虚拟环境:mkvirtualenv –python = python3.6
>使用pip安装要求:pip install -r requirements.txt

标签:python,14-04
来源: https://codeday.me/bug/20190807/1612886.html