【问题标题】:gcc 6.3 --> Fatal Python error: Py_Initialize: Unable to get the locale encoding ModuleNotFoundError: No module named 'encodings'gcc 6.3 --> 致命的 Python 错误:Py_Initialize:无法获取语言环境编码 ModuleNotFoundError:没有名为“编码”的模块
【发布时间】:2020-03-09 22:05:28
【问题描述】:

我正在尝试安装 Python 包,但在 CentOS7 中出现此错误:

Fatal Python error: Py_Initialize: Unable to get the locale encoding

ModuleNotFoundError: No module named 'encodings'

完整的日志在这里:https://pastebin.com/raw/xs6zFKVg

这是来自 NVIDIA 的名为 Kaolin 的软件包:https://github.com/NVIDIAGameWorks/kaolin

在我切换到 gcc 6.3 并输入以下命令后发生此错误:python setup.py install

我应该如何解决它?

请注意,最初我使用的是 GCC 7,然后我使用以下命令转移到 GCC 6.3(似乎 CUDA 与 GCC 7 存在兼容性问题,所以我不得不切换):

$ sudo yum install devtoolset-6

$ scl enable devtoolset-6 bash

现在我有:

$ gcc --version
gcc (GCC) 6.3.1 20170216 (Red Hat 6.3.1-3)
Copyright (C) 2016 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
I am not sure if what I did above was the best bet or if this must have caused this new issue.

【问题讨论】:

  • 您是否检查过搜索此错误时出现的其他问题,例如this question
  • 所以该修复程序适用于 Windows 10。我的问题出现在 CentOS 7 中。我想知道这是因为切换到 GCC 6 的方式可能不正确吗?

标签: python gcc


【解决方案1】:

我使用以下命令解决了这个问题:

$ conda create -p /scratch3/3d_pose/kaolin_env python=3.6 numpy cython pytorch-gpu "matplotlib<3.0.0" scikit-image shapely "trimesh>=3.0" scipy sphinx "pytest>=4.6" "pytest-cov>=2.7" tqdm Cython autopep8 flake8

$ conda activate /scratch3/3d_pose/kaolin_env

$ pip install pptk

$ python setup.py install

即使来自 .. of kaolin repo,import kaolin 仍然会引发错误。

【讨论】:

    猜你喜欢
    • 2019-08-31
    • 2014-01-16
    • 1970-01-01
    • 2017-01-03
    • 1970-01-01
    • 2013-05-06
    • 2015-08-26
    • 2020-07-03
    • 2017-07-19
    相关资源
    最近更新 更多