python-3.x - zlib1g-dev 已安装但显示 ModuleNotFoundError: No module named 'zlib'
问题描述
在我的 Debian 10 操作系统中,我有几个 Python 版本,分别为 2.7、3.7 和 3.8。对于 Python 3.8,pip 不起作用(没有模块名称 pip),我尝试使用“sudo python3.8 get-pip.py”为 Python 3.8 安装 pip,它显示以下错误。
Traceback (most recent call last):
File "<frozen zipimport>", line 520, in _get_decompress_func
ModuleNotFoundError: No module named 'zlib'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<frozen zipimport>", line 568, in _get_data
File "<frozen zipimport>", line 523, in _get_decompress_func
zipimport.ZipImportError: can't decompress data; zlib not available
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "get-pip.py", line 23704, in <module>
main()
File "get-pip.py", line 198, in main
bootstrap(tmpdir=tmpdir)
File "get-pip.py", line 82, in bootstrap
from pip._internal.cli.main import main as pip_entry_point
File "<frozen zipimport>", line 241, in load_module
File "<frozen zipimport>", line 709, in _get_module_code
File "<frozen zipimport>", line 570, in _get_data
zipimport.ZipImportError: can't decompress data; zlib not available
然后,我尝试使用 'sudo apt install zlib1g-dev' 安装 zlib,但它显示该软件包已经在系统中。
Reading package lists... Done
Building dependency tree
Reading state information... Done
zlib1g-dev is already the newest version (1:1.2.11.dfsg-1).
The following packages were automatically installed and are no longer required:
adb android-libadb android-libbase android-libboringssl
android-libcrypto-utils android-libcutils android-liblog
android-sdk-platform-tools-common arch-test bridge-utils cloud-image-utils
debootstrap distro-info genisoimage libayatana-appindicator3-1
libayatana-ido3-0.4-0 libayatana-indicator3-7 libboost-log1.67.0
libboost-program-options1.67.0 libboost-regex1.67.0
libboost-serialization1.67.0 liblxc1 libmotif-common libnma0 libpam-cgfs
libprotobuf-lite17 libsdl2-image-2.0-0 libu2f-udev libxm4 lxc lxc-templates
lxcfs network-manager-gnome qemu-utils squashfs-tools uidmap
Use 'sudo apt autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 127 not upgraded.
解决方案
您可以尝试这样做吗: sudo apt-get install zlib1g-dev
推荐阅读
- javascript - 如何通过与地图元素比较来创建新字符串?
- python - Qiskit:如何在量子电路中为每个镜头使用不同的状态?
- django - Django postgresql postgis不正确的空间查找
- android - 从图库或相机返回后不调用 onActivityResult
- android - 如何在底部导航视图中放置选项卡式布局?
- c# - 访问令牌中不包含 Azure AD v2 角色
- java - 如何使用 JPA EntityManager 选择多个列,包括外部实体
- javascript - 根据标签转发给不同的用户 - Gmail Apps 脚本
- visual-studio - 为什么我不能使用 sourcelink 调试我的 nuget 包?
- javascript - 在 typescript 中扩展 react-select 接口属性