成功解決ModuleNotFoundError: No module named codecs

成功解決ModuleNotFoundError: No module named 'codecs'

 

 

 

目錄

解決問題

解決思路

解決方法

1、第一次嘗試—在系統環境變量內添加路徑


 

 

解決問題

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'

 

 

 

解決思路

模塊未找到錯誤:沒有命名爲“codecs”的模塊

""" 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 ([email protected]).

(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 ([email protected])。

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

 

 

解決方法

1、第一次嘗試—在系統環境變量內添加路徑

PYTHONPATH
F:/Program Files/Python/Python36/Lib

 

 

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章