我正在尝试安装 python3 virtualenv。当我尝试运行 virtualenv 时,我收到以下消息。
virtualenv
Command 'virtualenv' not found, but can be installed with:
apt install python3-virtualenv
但是如果我运行安装命令,则会出现以下错误。
apt install python3-virtualenv
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package python3-virtualenv
对于python3 -m venv
,我收到使用apt-get install python3-venv
安装的消息 但是当我尝试它时,我会收到相同的消息。
sudo apt-get install python3-venv
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package python3-venv is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
E: Package 'python3-venv' has no installation candidate
我以根身份运行它。 WGET也有效。
AFAIU 最新版本的 Ubuntu 完全删除了 Python2,因此 Python3 现在只是 Python。尝试:
apt-get update
apt-get install python3-virtualenv
尝试在终端中键入:
sudo apt-get install python3.8-venv
然后再次尝试安装虚拟环境
这肯定会起作用:
sudo apt-get update
sudo apt-get install python3-virtualenv
下面和博士的回答很相似,但我新安装的 Ubuntu 20.04 仍然需要 python 版本号:
apt-get update
apt-get install python3-virtualenv
我也遇到了这个问题,并且能够通过以下方法解决它:
software-properties-gtk
单击后,输入会弹出一个窗口。然后,您必须选中前4个框,将其关闭并刷新。 之后问题应该得到解决,你就可以开始了
我收到错误E: Unable to locate package python3-virtualenv
因为我必须先跑apt-get update
。这是我全新的 GCP 实例。
参考:此线程中第一个答案的第一条评论。 无法在虚拟机上的 ubuntu-13 中找到软件包虚拟环境
谢谢大家。
sudo apt install python3-virtualenv
请尝试以下操作
sudo apt install python3-pip
pip install virtualenv
virtualenv xyz-venv
陷阱如下:
sudo apt update
sudo apt install python3-virtualenv
但python3 -m venv
不再有效。请改用virtualenv venv
。照常使用. venv/bin/activate
激活。
首先获取更新的信息,然后使用以下两个命令同时安装虚拟环境。
sudo apt update
sudo apt install python3-virtualenv
对于此问题:
sudo apt-get install python3-venv
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package python3-venv is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
E: Package 'python3-venv' has no installation candidate
我发现我必须先使用sudo -s
才能使用 root 权限。然后运行:
apt-get update
apt-get install python3-venv
它奏效了。我正在开发 Ubuntu 18.04.5 LTS