我已按照网上的一些解决方案操作,请帮忙,谢谢!
$ sudo apt-get update
$ sudo apt-get upgrade
$ sudo apt-get install libssl-dev openssl libreadline-dev
$ cd ~
$ wget https://www.python.org/ftp/python/3.6.1/Python-3.6.1.tgz
$ tar zxf Python-3.6.1.tgz
$ cd Python-3.6.1
$ ./configure
$ make
$ sudo make install
但安装 Python3 后我无法导入 telepot
peter@dvr:~$ python3 --version
Python 3.6.1
peter@dvr:~$ pip3 --version
pip 9.0.1 from /usr/lib/python3/dist-packages (python 3.6)
peter@dvr:~$ python3
Python 3.6.1 (default, Dec 27 2019, 10:01:53)
[GCC 7.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import telepot
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/peter/.local/lib/python3.6/site-packages/telepot/__init__.py", line 346, in <module>
from . import api
File "/home/peter/.local/lib/python3.6/site-packages/telepot/api.py", line 1, in <module>
import urllib3
File "/home/peter/.local/lib/python3.6/site-packages/urllib3/__init__.py", line 7, in <module>
from .connectionpool import HTTPConnectionPool, HTTPSConnectionPool, connection_from_url
File "/home/peter/.local/lib/python3.6/site-packages/urllib3/connectionpool.py", line 39, in <module>
from .response import HTTPResponse
File "/home/peter/.local/lib/python3.6/site-packages/urllib3/response.py", line 3, in <module>
import zlib
ModuleNotFoundError: No module named 'zlib'
>>>
答案1
步骤 1:使用以下命令更新软件包列表:
sudo apt update
步骤 2:使用以下命令为 Python 3 安装 pip:
sudo apt install python3-pip
步骤 3:安装完成后,通过检查 pip 版本来验证安装:
pip3 --version