我已经使用 apt 安装了 python2 和 python3。
我曾尝试使用
$ virtualenv -p python3 testenv1
并得到
Running virtualenv with interpreter /usr/local/bin/python3
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/virtualenv.py", line 22, in <module>
import zlib
ImportError: No module named 'zlib'
我搜索过
$ sudo find / -name 'libz.*'
[sudo] password for x:
find: ‘/run/user/1000/gvfs’: Permission denied
/snap/core/7917/lib/x86_64-linux-gnu/libz.so.1
/snap/core/7917/lib/x86_64-linux-gnu/libz.so.1.2.8
/snap/core/7713/lib/x86_64-linux-gnu/libz.so.1
/snap/core/7713/lib/x86_64-linux-gnu/libz.so.1.2.8
/snap/core18/1144/lib/x86_64-linux-gnu/libz.so.1
/snap/core18/1144/lib/x86_64-linux-gnu/libz.so.1.2.11
/snap/core18/1192/lib/x86_64-linux-gnu/libz.so.1
/snap/core18/1192/lib/x86_64-linux-gnu/libz.so.1.2.11
/usr/lib/x86_64-linux-gnu/libz.so
/usr/lib/x86_64-linux-gnu/libz.a
/lib/x86_64-linux-gnu/libz.so.1.2.11
/lib/x86_64-linux-gnu/libz.so.1
有没有办法使用 apt 安装带有 zlib 的 python3?
如果没有的话,您能否给我指明如何进行的明确说明?
谢谢!
答案1
步骤 1:使用 apt搜索特征
$ apt search python3 zlib
Sorting... Done
Full Text Search... Done
python3-netcdf4/disco 1.4.2-1build1 amd64
Python 3 interface to the netCDF4 (network Common Data Form) library
第 2 步:使用 apt展示功能来确定它是否是您真正想要的包。
$ apt show python3-netcdf4
Package: python3-netcdf4
Version: 1.4.2-1build1
Priority: optional
Section: universe/python
Source: netcdf4-python
Origin: Ubuntu
Maintainer: Ubuntu Developers <[email protected]>
Original-Maintainer: Debian GIS Project <[email protected]>
Bugs: https://bugs.launchpad.net/ubuntu/+filebug
Installed-Size: 1,599 kB
Depends: python3 (<< 3.8), python3 (>= 3.7~), python3-cftime, python3-numpy (>= 1:1.14.3), python3-numpy-abi9, python3:any, libc6 (>= 2.14), libhdf5-103, libnetcdf13 (>= 1:4.4.0)
Homepage: http://unidata.github.io/netcdf4-python/
Download-Size: 476 kB
APT-Sources: http://us.archive.ubuntu.com/ubuntu disco/universe amd64 Packages
Description: Python 3 interface to the netCDF4 (network Common Data Form) library
NetCDF version 4 has many features not found in earlier versions of the
library and is implemented on top of HDF5. This module can read and write
files in both the new netCDF 4 and the old netCDF 3 format, and can create
files that are readable by HDF5 clients. The API is modelled after
Scientific.IO.NetCDF, and should be familiar to users of that module.
.
Most new features of netCDF 4 are implemented, such as multiple unlimited
dimensions, groups and zlib data compression. All the new numeric data types
(such as 64 bit and unsigned integer types) are implemented. Compound and
variable length (vlen) data types are supported, but the enum and opaque data
types are not. Mixtures of compound and vlen data types (compound types
containing vlens, and vlens containing compound types) are not supported.
.
This package contains the netCDF 4 module for Python 3.
如果没有任何 apt 包提供您想要的内容,那么请开始查看 pip 包。