python导入第三方类库(chardet)

python 模块 chardet下载及介绍

1、pytcharm中报错

Traceback (most recent call last):
  File "C:/Users/ArcerZhang/Documents/Python/MyProjects/路飞学城-Python21天入门必备/第三章节 Python文件操作、函数、装饰器/71-文件处理-智能检测编码的工具.py", line 1, in <module>
    import chardet
ModuleNotFoundError: No module named 'chardet'

Process finished with exit code 1

2、安装第三方类库

C:UsersArcerZhang>cd C:UsersArcerZhangAppDataLocalProgramsPythonPython36-32Scripts

C:UsersArcerZhangAppDataLocalProgramsPythonPython36-32Scripts>dir
 驱动器 C 中的卷是 Windows7_OS
 卷的序列号是 5888-40CA

 C:UsersArcerZhangAppDataLocalProgramsPythonPython36-32Scripts 的目录

2017/12/14  15:04    <DIR>          .
2017/12/14  15:04    <DIR>          ..
2017/12/14  15:04            89,499 easy_install-3.6.exe
2017/12/14  15:04            89,499 easy_install.exe
2017/12/14  15:04            89,471 pip.exe
2017/12/14  15:04            89,471 pip3.6.exe
2017/12/14  15:04            89,471 pip3.exe
               5 个文件        447,411 字节
               2 个目录 124,068,610,048 可用字节

C:UsersArcerZhangAppDataLocalProgramsPythonPython36-32Scripts>pip3.6.exe install chardet
Collecting chardet
  Downloading https://files.pythonhosted.org/packages/bc/a9/01ffebfb562e4274b6487b4bb1ddec7ca55ec7510b22e4c51f14098443b8/chardet-3.0.4-py2.py3-none-any.whl (133kB)
    100% |████████████████████████████████| 143kB 699kB/s
Installing collected packages: chardet
Successfully installed chardet-3.0.4
You are using pip version 9.0.1, however version 10.0.1 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.

C:UsersArcerZhangAppDataLocalProgramsPythonPython36-32Scripts>

3、 升级pip程序

C:UsersArcerZhangAppDataLocalProgramsPythonPython36-32Scripts>python -m pip install --upgrade pip
Collecting pip
  Downloading https://files.pythonhosted.org/packages/0f/74/ecd13431bcc456ed390b44c8a6e917c1820365cbebcb6a8974d1cd045ab4/pip-10.0.1-py2.py3-none-any.whl (1.3MB)
    100% |████████████████████████████████| 1.3MB 202kB/s
Installing collected packages: pip
  Found existing installation: pip 9.0.1
    Uninstalling pip-9.0.1:
      Successfully uninstalled pip-9.0.1
Successfully installed pip-10.0.1

C:UsersArcerZhangAppDataLocalProgramsPythonPython36-32Scripts>
原文地址:https://www.cnblogs.com/arcer/p/9045312.html