成功解决ModuleNotFoundError: No module named codecs

简介: 成功解决ModuleNotFoundError: No module named codecs

解决问题


Fatal Python error: Py_Initialize: unable to load the file system codec

Traceback (most recent call last):

 File "f:\program files\python\python36\lib\encodings\__init__.py", line 31, in <module>

ModuleNotFoundError: No module named 'codecs'

image.png






解决思路


模块未找到错误:没有命名为“codecs”的模块

image.png



""" Standard "encodings" Package

   Standard Python encoding modules are stored in this package directory.

   Codec modules must have names corresponding to normalized encoding names as defined in the normalize_encoding() function below, e.g. 'utf-8' must be implemented by the module 'utf_8.py'.

   Each codec module must export the following interface:

   * getregentry() -> codecs.CodecInfo object

   The getregentry() API must return a CodecInfo object with encoder, decoder,  incrementalencoder, incrementaldecoder, streamwriter and streamreader   atttributes which adhere to the Python Codec Interface Standard.

   In addition, a module may optionally also define the following APIs which are then used by the package's codec search function:

   * getaliases() -> sequence of encoding name strings to use as aliases

   Alias names returned by getaliases() must be normalized encoding names as defined by normalize_encoding().

Written by Marc-Andre Lemburg (mal@lemburg.com).

(c) Copyright CNRI, All Rights Reserved. NO WARRANTY.

"""标准""编码"包

标准Python编码模块存储在这个包目录中。

编解码器模块必须具有与下面normalize_encoding()函数中定义的规范化编码名称相对应的名称,例如。“utf-8”必须由模块“utf_8.py”实现。

每个编解码器模块必须导出以下接口:

* getregentry() ->编解码器。CodecInfo对象

getregentry() API必须返回一个CodecInfo对象,该对象具有符合Python编解码接口标准的编码器、解码器、增量编码器、增量解码器、streamwriter和streamreader atttributes。

此外,模块还可以选择定义以下api,然后由包的编解码器搜索功能使用:

* getaliases() -编码名称字符串作为别名的>序列

getaliases()返回的别名必须是normalize_encoding()定义的规范化编码名。

作者Marc-Andre Lemburg (mal@lemburg.com)。

(c) CNRI版权所有不保修的。



解决方法


1、第一次尝试—在系统环境变量内添加路径


PYTHONPATH

F:/Program Files/Python/Python36/Lib

image.png





 


相关文章
ModuleNotFoundError: No module named ‘mmdet.version‘
ModuleNotFoundError: No module named ‘mmdet.version‘
1512 0
|
4月前
|
Linux Shell iOS开发
ModuleNotFoundError: No module named 'readline' 是什么问题
【6月更文挑战第17天】ModuleNotFoundError: No module named 'readline' 是什么问题
326 1
|
5月前
|
Linux PyTorch 算法框架/工具
[已解决]ModuleNotFoundError: No module named ‘einops‘
[已解决]ModuleNotFoundError: No module named ‘einops‘
|
11月前
Py3 ModuleNotFoundError: No module named ‘Crypto‘;ModuleNotFoundError: No module named Cryptodome‘
Py3 ModuleNotFoundError: No module named ‘Crypto‘;ModuleNotFoundError: No module named Cryptodome‘
85 0
|
11月前
ModuleNotFoundError: No module named ‘exceptions‘
ModuleNotFoundError: No module named ‘exceptions‘
ModuleNotFoundError: No module named ‘sentencepiece‘
ModuleNotFoundError: No module named ‘sentencepiece‘
222 0
ModuleNotFoundError: No module named ‘pydensecrf‘解决办法
ModuleNotFoundError: No module named ‘pydensecrf‘解决办法
296 0
ModuleNotFoundError: No module named 'torchstat'
ModuleNotFoundError: No module named 'torchstat'
425 0
ModuleNotFoundError: No module named 'torchstat'
|
Python
ModuleNotFoundError: No module named ‘pyexpat‘
ModuleNotFoundError: No module named ‘pyexpat‘
212 0
|
计算机视觉 C++ Python
解决ModuleNotFoundError: No module named ‘skimage‘问题
解决ModuleNotFoundError: No module named ‘skimage‘问题
2626 0
解决ModuleNotFoundError: No module named ‘skimage‘问题