[ubuntu] ubuntu18.04 python出现 import openpyxlModuleNotFoundError: No module named ‘openpyxl‘解决方案

问题log

 import openpyxl
ModuleNotFoundError: No module named 'openpyxl'

解决方案

安装pip3

sudo apt install python3-pip

# apt install python3-pip
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following additional packages will be installed:
  dh-python python3-dev python3-setuptools python3-wheel python3.6-dev
Suggested packages:
  python-setuptools-doc
The following NEW packages will be installed:
  dh-python python3-dev python3-pip python3-setuptools python3-wheel python3.6-dev
0 upgraded, 6 newly installed, 0 to remove and 306 not upgraded.
Need to get 1 000 kB of archives.
After this operation, 3 062 kB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://mirrors.aliyun.com/ubuntu bionic/main amd64 dh-python all 3.20180325ubuntu2 [89,2 kB]
Get:2 http://mirrors.aliyun.com/ubuntu bionic-security/main amd64 python3.6-dev amd64 3.6.9-1~18.04ubuntu1.12 [511 kB]
Get:3 http://mirrors.aliyun.com/ubuntu bionic-updates/main amd64 python3-dev amd64 3.6.7-1~18.04 [1 288 B]
Get:4 http://mirrors.aliyun.com/ubuntu bionic-security/universe amd64 python3-pip all 9.0.1-2.3~ubuntu1.18.04.8 [114 kB]
Get:5 http://mirrors.aliyun.com/ubuntu bionic-security/main amd64 python3-setuptools all 39.0.1-2ubuntu0.1 [248 kB]
Get:6 http://mirrors.aliyun.com/ubuntu bionic-security/universe amd64 python3-wheel all 0.30.0-0.2ubuntu0.1 [36,7 kB]
Fetched 1 000 kB in 1s (1 546 kB/s)        
Selecting previously unselected package dh-python.
(Reading database ... 186315 files and directories currently installed.)
Preparing to unpack .../0-dh-python_3.20180325ubuntu2_all.deb ...
Unpacking dh-python (3.20180325ubuntu2) ...
Selecting previously unselected package python3.6-dev.
Preparing to unpack .../1-python3.6-dev_3.6.9-1~18.04ubuntu1.12_amd64.deb ...
Unpacking python3.6-dev (3.6.9-1~18.04ubuntu1.12) ...
Selecting previously unselected package python3-dev.
Preparing to unpack .../2-python3-dev_3.6.7-1~18.04_amd64.deb ...
Unpacking python3-dev (3.6.7-1~18.04) ...
Selecting previously unselected package python3-pip.
Preparing to unpack .../3-python3-pip_9.0.1-2.3~ubuntu1.18.04.8_all.deb ...
Unpacking python3-pip (9.0.1-2.3~ubuntu1.18.04.8) ...
Selecting previously unselected package python3-setuptools.
Preparing to unpack .../4-python3-setuptools_39.0.1-2ubuntu0.1_all.deb ...
Unpacking python3-setuptools (39.0.1-2ubuntu0.1) ...
Selecting previously unselected package python3-wheel.
Preparing to unpack .../5-python3-wheel_0.30.0-0.2ubuntu0.1_all.deb ...
Unpacking python3-wheel (0.30.0-0.2ubuntu0.1) ...
Setting up python3-wheel (0.30.0-0.2ubuntu0.1) ...
Setting up python3-pip (9.0.1-2.3~ubuntu1.18.04.8) ...
Setting up python3-setuptools (39.0.1-2ubuntu0.1) ...
Setting up python3.6-dev (3.6.9-1~18.04ubuntu1.12) ...
Setting up dh-python (3.20180325ubuntu2) ...
Setting up python3-dev (3.6.7-1~18.04) ...
Processing triggers for man-db (2.8.3-2) ...

安装openpyxl

sudo pip3 install openpyxl

# pip3 install openpyxl
Collecting openpyxl
  Downloading https://files.pythonhosted.org/packages/6a/94/a59521de836ef0da54aaf50da6c4da8fb4072fb3053fa71f052fd9399e7a/openpyxl-3.1.2-py2.py3-none-any.whl (249kB)
    100% |████████████████████████████████| 256kB 1.1MB/s 
Collecting et-xmlfile (from openpyxl)
  Downloading https://files.pythonhosted.org/packages/96/c2/3dd434b0108730014f1b96fd286040dc3bcb70066346f7e01ec2ac95865f/et_xmlfile-1.1.0-py3-none-any.whl
Installing collected packages: et-xmlfile, openpyxl
Successfully installed et-xmlfile-1.1.0 openpyxl-3.1.2

  • 3
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

wellnw

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值