Use the below command to install virtualenv in Ubuntu:
$ sudo apt-get install virtualenv
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
python3-virtualenv
The following NEW packages will be installed:
python3-virtualenv virtualenv
0 upgraded, 2 newly installed, 0 to remove and 9 not upgraded.
Need to get 47.8 kB of archives.
After this operation, 171 kB of additional disk space will be used.
Do you want to continue? [Y/n] Y
Get:1 http://in.archive.ubuntu.com/ubuntu bionic/universe amd64 python3-virtualenv all 15.1.0+ds-1.1 [43.4 kB]
Get:2 http://in.archive.ubuntu.com/ubuntu bionic/universe amd64 virtualenv all 15.1.0+ds-1.1 [4,476 B]
Fetched 47.8 kB in 1s (49.2 kB/s)
Selecting previously unselected package python3-virtualenv.
(Reading database ... 205693 files and directories currently installed.)
Preparing to unpack .../python3-virtualenv_15.1.0+ds-1.1_all.deb ...
Unpacking python3-virtualenv (15.1.0+ds-1.1) ...
Selecting previously unselected package virtualenv.
Preparing to unpack .../virtualenv_15.1.0+ds-1.1_all.deb ...
Unpacking virtualenv (15.1.0+ds-1.1) ...
Setting up python3-virtualenv (15.1.0+ds-1.1) ...
Processing triggers for man-db (2.8.3-2) ...
Setting up virtualenv (15.1.0+ds-1.1) ...
$
$ sudo apt-get install virtualenv
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
python3-virtualenv
The following NEW packages will be installed:
python3-virtualenv virtualenv
0 upgraded, 2 newly installed, 0 to remove and 9 not upgraded.
Need to get 47.8 kB of archives.
After this operation, 171 kB of additional disk space will be used.
Do you want to continue? [Y/n] Y
Get:1 http://in.archive.ubuntu.com/ubuntu bionic/universe amd64 python3-virtualenv all 15.1.0+ds-1.1 [43.4 kB]
Get:2 http://in.archive.ubuntu.com/ubuntu bionic/universe amd64 virtualenv all 15.1.0+ds-1.1 [4,476 B]
Fetched 47.8 kB in 1s (49.2 kB/s)
Selecting previously unselected package python3-virtualenv.
(Reading database ... 205693 files and directories currently installed.)
Preparing to unpack .../python3-virtualenv_15.1.0+ds-1.1_all.deb ...
Unpacking python3-virtualenv (15.1.0+ds-1.1) ...
Selecting previously unselected package virtualenv.
Preparing to unpack .../virtualenv_15.1.0+ds-1.1_all.deb ...
Unpacking virtualenv (15.1.0+ds-1.1) ...
Setting up python3-virtualenv (15.1.0+ds-1.1) ...
Processing triggers for man-db (2.8.3-2) ...
Setting up virtualenv (15.1.0+ds-1.1) ...
$
Refer: