Viscosity only applies to fluids, ie. gas and liquid.
However, the nature of viscosity for gas and liquid are different.
In general, the liquid viscosity is dependent on the strength of intermolecular attraction. The stronger the intermolecular attraction, the more the viscous the liquid is. In fact, raising the temperature of the liquid decreases its viscosity. This reflects the viscosity of a liquid is indeed dependent on the intermolecular attraction.
In general, the viscosity of a gas is dependent on the frequency of molecular collision. The higher the frequency of molecular collision, the more unlikely each gas molecule were to gain in displacement as their movement is being impeded by the molecular collision. In fact, raising the temperature of the gas increases its viscosity.