Yes, you can with the Left 4 Bots addon. Among many other bot-related tweaks and improvements, it also allows you to:
[...] play a singleplayer versus match and practice as infected against a full survivor bot team (granted you enables the addons in versus mode in the game's "addonconfig.cfg" file)
L4D2 doesn't allow mods or addons to run in versus mode by default as of a November 2018 update, so you'll have to configure the game to allow addons in versus mode first. Open
\Left 4 Dead 2\left4dead2\cfg\addonconfig.cfg with a text editor and then change all values to
0 and save the file. It should look like this:
"mutation15" "0" // versus survival
Then, subscribe to Left 4 Bots in the Steam Workshop and then run the game and enable the addon to complete the installation. Once installed, configure Left 4 Bots for singleplayer versus gameplay. Open the file,
\Left 4 Dead 2\left4dead2\ems\left4bots\cfg\convars.txt with a text editor and add the following line to it:
vs_max_team_switches 999. That console variable allows you to switch between the infected and the survivor teams as many times as needed. (By default, you can only switch teams once per match.) You need to be able to do that because in some map sections, the survivor bots are not able to proceed forward and could get stuck if there is no human player on the team. You'll have to temporarily switch to the survivor team to lead the survivor bots forward.
To start a singleplayer versus match, open the console by pressing the tilde (~) key, then enter the command:
map [map name] versus. (See list of all map names here.) E.g., to start the Dead Center campaign's first map, enter
map c1m1_hotel versus. If you find that the survivor bots are stuck or are not moving forward through the map, switch to the survivor team by pressing M and then lead them out of the part where they are stuck, and then press M again to switch back to the infected team.
You can also set other L4D2 console variables (cvars) in Left 4 Bots without disabling achievements.
Usually the cvars can be set via console but most of them can be
changed only if sv_cheats (which is also a cvar) is set to 1 but this
disables the achievements. VScript addons like this can change the
cvars on the fly without the need to set sv_cheats to 1 so without
disabling the achievements.
- Left 4 Bots advanced configuration