如何在 Ubuntu 20.04 GCP 实例上安装 virtualenv? [英] how to install virtualenv on Ubuntu 20.04 GCP instance?

查看:43
本文介绍了如何在 Ubuntu 20.04 GCP 实例上安装 virtualenv?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试安装 python3 virtualenv.当我尝试运行 virtualenv 时,我收到以下消息.

I am trying to install python3 virtualenv. I get the following message when I try to run virtualenv.

virtualenv
Command 'virtualenv' not found, but can be installed with:
apt install python3-virtualenv

但是如果我运行 install 命令,我会收到以下错误.

but if I run install command, I get the following error.

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 安装的消息但是当我尝试时,我得到了同样的信息.

For python3 -m venv, I get message to install using apt-get install python3-venv but when I try it, I get the same message.

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

我以 root 身份运行它.wget 也有效.

I am running this as root. wget also works.

推荐答案

AFAIU 最新版本的 Ubuntu 完全删除了 Python2,因此 Python3 现在只是 Python.试试:

AFAIU the latest versions of Ubuntu removed Python2 altogether so Python3 is now just the Python. Try:

apt-get update
apt-get install python3-virtualenv

这篇关于如何在 Ubuntu 20.04 GCP 实例上安装 virtualenv?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆