Python 3.7导入请求返回“ Chardet”错误

时间:2018-08-09 20:42:31

标签: python python-3.x python-requests

在python3中导入请求时,出现以下错误:

Python 3.7.0 (v3.7.0:1bf9cc5093, Jun 27 2018, 04:06:47) [MSC v.1914 32
bit  (Intel)] on win32 Type "help", "copyright", "credits" or
"license" for more information
>>>> import requests 
Traceback (most recent call last): File "<stdin>", line 1, in <module> File
"C:\Users\Administrator\AppData\Local\Programs\Python\Python37-32\lib\site-packages\requests-2.19.1-py3.7.egg\requests\__init__.py", line 44, in <module> 
import chardet 
ModuleNotFoundError: No module named 'chardet'

这是一个全新的安装,但由于我正在使用env,因此无法使用pip来安装请求。我必须下载源代码并通过setup.py安装文件进行安装。

进行一些搜索会产生一些结果,但是似乎并不能解决我的情况。

谢谢

2 个答案:

答案 0 :(得分:2)

这是一个依赖项,您的站点包中没有该依赖项。既然您说不能使用pip,则必须手动安装依赖项。

const numberShow = function() {
const detectSection = document.getElementsByClassName('section fp-section active fp-completely')[0].id;
const inc = document.getElementById('inc');

switch (detectSection) {
    case section0:
        inc.innerHTML = '00.';
    case section1:
        inc.innerHTML ='01.';
        break;
    case section2:
        inc.innerHTML ='02.';
        break;
    case section3:
        inc.innerHTML ='03.';
        break;
    case section4:
        inc.innerHTML ='04.';
        break;
    case section5:
        inc.innerHTML ='05.';
        break;
    case section6:
        inc.innerHTML ='06.';
        break;

    default:
        break;
}
};
//Call numberShow every 500 millisecs to check current active class and 
//change the number
setInterval(numberShow(), 500);

这是请求安装文件,它是请求的要求。尝试安装所有这些,然后重试。

希望这会有所帮助!

答案 1 :(得分:0)

尝试使用以下命令安装chardet模块:

pip3 install chardet