Ubuntu 使用 Python 时出现“无法导入站点模块”错误消息

Ubuntu 使用 Python 时出现“无法导入站点模块”错误消息

当我尝试使用以下命令运行 Python 文件时,会出现以下错误消息python3 training.py

我找到了一个潜在的解决方案这里但是当我按照建议进行更改时,我发现我的机器似乎具有正确的设置。

需要澄清的是,我做了大量研究,以下修复均无效

有什么建议可以解决此问题吗?如何修复?由于此错误,我目前无法提交课程作业 :(

Failed to import the site module
Traceback (most recent call last):
  File "/usr/lib/python3.5/site.py", line 580, in <module>
    main()
  File "/usr/lib/python3.5/site.py", line 566, in main
    known_paths = addusersitepackages(known_paths)
  File "/usr/lib/python3.5/site.py", line 287, in addusersitepackages
    user_site = getusersitepackages()
  File "/usr/lib/python3.5/site.py", line 263, in getusersitepackages
    user_base = getuserbase() # this will also set USER_BASE
  File "/usr/lib/python3.5/site.py", line 253, in getuserbase
    USER_BASE = get_config_var('userbase')
  File "/usr/lib/python3.5/sysconfig.py", line 595, in get_config_var
    return get_config_vars().get(name)
  File "/usr/lib/python3.5/sysconfig.py", line 538, in get_config_vars
    _init_posix(_CONFIG_VARS)
  File "/usr/lib/python3.5/sysconfig.py", line 410, in _init_posix
    from _sysconfigdata import build_time_vars
  File "/usr/lib/python3.5/_sysconfigdata.py", line 6, in <module>
    from _sysconfigdata_m import *
ImportError: No module named '_sysconfigdata_m'

答案1

我必须升级到 Ubuntu 17.04

相关内容