尝试启动虚拟环境时,我得到:
~$ python3 -m venv homeassistant
The virtual environment was not created successfully because ensurepip is not
available. On Debian/Ubuntu systems, you need to install the python3-venv
package using the following command.
apt-get install python3-venv
You may need to use sudo with that command. After installing the python3-venv
package, recreate your virtual environment.
Failing command: ['/home/gal/homeassistant/bin/python3', '-Im', 'ensurepip', '--upgrade', '--default-pip']
但是当我尝试安装 python3-venv 我得到:
~$ sudo apt-get install python3-venv
Reading package lists... Done
Building dependency tree
Reading state information... Done
python3-venv is already the newest version (3.6.7-1~18.04).
0 upgraded, 0 newly installed, 0 to remove and 38 not upgraded.
我应该安装几个 python 版本,但我将它们作为替代方案删除:
~$ sudo update-alternatives --config python3
There is only one alternative in link group python3 (providing /usr/bin/python3): /~$ sudo update-alternatives --config python3
There is only one alternative in link group python3 (providing /usr/bin/python3): /usr/bin/python3.7
Nothing to configure.usr/bin/python3.7
Nothing to configure.
Python 版本是 3.7.5:
~$ python3 --version
Python 3.7.5
操作系统版本为:
~$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 18.04.4 LTS
Release: 18.04
Codename: bionic
我认为问题在于'python3-venv 已经是最新版本(3.6.7-1~18.04)。而我使用的版本是 3.7 而不是 3.6。但我不知道如何进行。
感谢您的任何建议。