ModuleNotFoundError(pandas,openpyxl,xlrd,jsonlines)

1. ModuleNotFoundError: No module named ‘pandas’

数据处理可以利用pandas

操作pip install pandas

直接操作可能卡住,可以连接手机4G网络重新试一下,第一次可能有警告多跑几次。

在这里插入图片描述

另外一种安装方式
此种方式可以适用于其他包,但是此种方式经过测试不太好用,还是需要连接代理。
https://www.lfd.uci.edu/~gohlke/pythonlibs/#pandas
![选择和自己python版本对应的whl](https://img-blog.csdnimg.cn/20200410112719834.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L29vb29vb29iaA==,size_16,color_FFFFFF,t_70)

 现在3.8python,64位系统版本
 选择pandas‑1.0.3‑cp38‑cp38‑win_amd64.whl
 放到项目文件件下使用pip安装
在.whl文件目录下安装pandas  
  python -m pip install --user pandas‑1.0.3‑cp38‑cp38‑win_amd64.whl
  或者
  pip install pandas‑1.0.3‑cp38‑cp38‑win_amd64.whl

2.ModuleNotFoundError: No module named ‘openpyxl’

excel解析需要安装openpyxl

操作pip install openpyxl
需要有耐心才能安装成功,安装了N遍用移动4G网络。

安装了N遍,还是移动网络4G

3.ImportError: Missing optional dependency ‘xlrd’. Install xlrd >= 1.0.0 for Excel support Use pip or conda to install xlrd.

解析写入xlsd用到
 pip install xlrd
 装了n次

在这里插入图片描述

4.ModuleNotFoundError: No module named ‘jsonlines’

逐行解析json文件用到
pip install jsonlines

在这里插入图片描述

5.ModuleNotFoundError: No module named ‘pyinstaller’

	将py文件生成可执行文件pyinstaller -F <文件名.py> 或者加图标  pyinstaller –i 1.ico –F HelloWorld.py
	
	pip install pyinstaller
	我只能感叹一句豆瓣无敌。

在这里插入图片描述

6.ModuleNotFoundError: No module named ‘requests’

  爬虫用到
  pip install requests  
  或者
  pip install requests -i  http://pypi.douban.com/simple --trusted-host=pypi.douban.com

requests
在这里插入图片描述

7.ModuleNotFoundError: No module named ‘bs4’

 爬虫用到
	pip install bs4
	或者
	 pip install bs4 -i  http://pypi.douban.com/simple --trusted-host=pypi.douban.com

bs4
在这里插入图片描述

8.ImportError: No module named Flask

  轻量web框架
   pip install flask

Collecting flask
Downloading Flask-1.1.2-py2.py3-none-any.whl (94 kB)
|████████████████████████████████| 94 kB 344 kB/s
Collecting Werkzeug>=0.15
Downloading Werkzeug-1.0.1-py2.py3-none-any.whl (298 kB)
|████████████████████████████████| 298 kB 819 kB/s
Collecting click>=5.1
Downloading click-7.1.1-py2.py3-none-any.whl (82 kB)
|████████████████████████████████| 82 kB 1.2 MB/s
Collecting itsdangerous>=0.24
Downloading itsdangerous-1.1.0-py2.py3-none-any.whl (16 kB)
Collecting Jinja2>=2.10.1
Downloading Jinja2-2.11.2-py2.py3-none-any.whl (125 kB)
|████████████████████████████████| 125 kB 1.1 MB/s
Collecting MarkupSafe>=0.23
Downloading MarkupSafe-1.1.1-cp38-cp38-win_amd64.whl (16 kB)
Installing collected packages: Werkzeug, click, itsdangerous, MarkupSafe, Jinja2, flask
Successfully installed Jinja2-2.11.2 MarkupSafe-1.1.1 Werkzeug-1.0.1 click-7.1.1 flask-1.1.2 itsdangerous-1.1.0

9.ModuleNotFoundError: No module named ‘selenium’

在这里插入图片描述

彩蛋:

豆瓣速度杠杠滴。。。。。。
国内源使用加快下载速度,实际效果得分资源,大家可以尝试一下。目前看豆瓣的速度可以
安装方法:pip install pyinstaller

国内建议使用国内源等加快下载速度,使用方式如下:

pip install -i <国内源> pyinstaller

国内源有清华、阿里、中科大等,可根据自己需求选择
让python pip使用国内镜像
国内源:
清华:https://pypi.tuna.tsinghua.edu.cn/simple
阿里云:http://mirrors.aliyun.com/pypi/simple/
中国科技大学 https://pypi.mirrors.ustc.edu.cn/simple/
华中理工大学:http://pypi.hustunique.com/
山东理工大学:http://pypi.sdutlinux.org/ 
豆瓣:http://pypi.douban.com/simple/
note:新版ubuntu要求使用https源,要注意。

例如:pip3 install -i https://pypi.doubanio.com/simple/ 包名
或者
 pip install 包名 -i  http://pypi.douban.com/simple --trusted-host=pypi.douban.com
 pip install requests -i  http://pypi.douban.com/simple --trusted-host=pypi.douban.com 
	这个豆瓣的速度可以

在这里插入图片描述
在这里插入图片描述
临时使用:
可以在使用pip的时候加参数-i https://pypi.tuna.tsinghua.edu.cn/simple
例如:pip install -i https://pypi.tuna.tsinghua.edu.cn/simple pyspider,这样就会从清华这边的镜像去安装pyspider库。

永久修改,一劳永逸:
Linux下,修改 ~/.pip/pip.conf (没有就创建一个文件夹及文件。文件夹要加“.”,表示是隐藏文件夹)

内容如下:
[global]
index-url = https://pypi.tuna.tsinghua.edu.cn/simple
[install]
trusted-host=mirrors.aliyun.com
windows下,直接在user目录中创建一个pip目录,再新建文件pip.ini。(例如:C:\Users\WQP\pip\pip.ini)内容同上。

ImportError: Missing optional dependency ‘xlrd’. Install xlrd >= 1.0.0 for Excel support Use pip or conda to install xlrd.
可以更新PIP

发布了81 篇原创文章 · 获赞 109 · 访问量 38万+

猜你喜欢

转载自blog.csdn.net/ooooooobh/article/details/105428647