Is Atmospheric Pressure due to weight of air or the collisions of the Molecules This question is in response to @brightmagnus  answer whose link is 
Pressure in Fluids,in particular horizontal pressure
The question :

Is the atmospheric pressure due to the weight of air or collisions of the molecules?

If according to bright magnus' answer it is due to both weight and collisions then if at sea level we close the cap of a bottle, then the pressure in the bottle will the pressure outside because the weight of the air above is transmitted through the cap. 
But if we take this same bottle at Everest or say space the weight of the air above would be significantly less at Everest and in the case of space there will be no air outside the bottle to transmit the pressure. But still the pressure in the bottle will be the same as it was at sea level. 
Why is it so? How has small column of air in the bottle got the same pressure as the entire atmosphere ( the bottle off course is of tough material and doesn't blast).
Also if the total pressure is due to both the weight of the air and the collisions of the molecules then why do we not include a pressure term due to collision of molecules in the equation for total pressure which is P =hpg and which includes the part of pressure only dusri weight. I am getting confused here. Can The same argument be extended to water? 
Edit
First , I would like to add my own answer. I think that at surface of the earth , when the bottle is open , the pressure at its bottom surface is hpg. When we close the cap, the external pressure remains hpg. The air inside the bottle tries to attain equilibrium and the velocity of the air molecules inside increases (or decreases) to attain a pressure equal to the external (to balance it) according to P =1/3pv^2.
Then when it's taken outside earth's atmosphere , the velocities  of the molecules remain the same(since there is no air outside ) and so doea the density and hence the Pressure.
Now I would like to extend the question
Suppose , I have a packed box of height h filled with air in space, the pressure inside it is P=1/3pv^2 (no gravity). Now suddenly the box is taken into a gravitational field. What would be the pressure inside ? I think it would somewhere between 1/3pv^2 + hpg (where v is original velocity of the molecules when they were outside the gravitational field and the new velocity would hence accordingly adjust)
But we give the entire pressure just by hpg. I understand that when the box is initially in a gravitational field the weight manifests itself as force per unit area due to the molecules colliding with velocity v. But when the box was not initially in gravitational field, the molecules in it did exert a pressure due to their velocity. But when it is brought in gravitational field shouldn't the total pressure be the sum of 1/3pv^2 and hpg?
 A: There is no need to contrapose collisions of molecules and weight of air!
You can take a syringe without a needle, close the muzzle with a finger and pull the piston a little. There will be a vacuum in the syringe under the piston, atmospheric pressure will push the piston back inside. Where this force come from? Atoms and molecules of the air collide with the surface of the piston and push it. The surface of piston "does not know" if there is some atmosphere around the Earth, it only "knows" some molecules and atoms are constantly bombarding it. By the way, there may be no Earth and atmosphere (f.e. inside the space station) - but from the syringe's point of view the situation would be the same: constant bombardment from molecules around and hence the pressure.
Situation is quite similar with liquids: the surface under pressure "knows" only about the molecules it contacts with. Still it is possible to calculate the pressure using formula F = Spg*H. But it would not be some additional component of the pressure!
Mechanism of air pressure is "bombardment" of the surface by molecules.
Rootcause of atmospheric pressure on Earth is the weight of air.
There may be many different ways to calculate the atmospheric pressure: to divide the total weight of the air over the total surface of Earth is one of them. This approach makes it possible to calculate the atmospheric pressure without going into details how exactly molecules collide with the surface, but the mechanism of air pressure remains the same: collisions between molecules.
A: Pressure is a thermodynamic variable.
Molecules are when one looks at the structure of matter and there statistical mechanics is used. 

The primary goal of statistical thermodynamics (also known as equilibrium statistical mechanics) is to derive the classical thermodynamics of materials in terms of the properties of their constituent particles and the interactions between them. In other words, statistical thermodynamics provides a connection between the macroscopic properties of materials in thermodynamic equilibrium, and the microscopic behaviours and motions occurring inside the material.

......

In 1738, Swiss physicist and mathematician Daniel Bernoulli published Hydrodynamica which laid the basis for the kinetic theory of gases. In this work, Bernoulli posited the argument, still used to this day, that gases consist of great numbers of molecules moving in all directions, that their impact on a surface causes the gas pressure that we feel, and that what we experience as heat is simply the kinetic energy of their motion

Note  the italics.Impact is a force, consistent with the thermodynamic definition of pressure as 

The innumerable impacts of the gas molecules which are statistically in all directions in a bottle in space with no extra force acting on it, are in all directions due to the chaotic nature of a gas.
Once a directional force is imposed , for example with a piston, the pressure will increase, it is directly calculable from the imposed force. A column of air will gradually have larger pressure at the low area because the weight of the gas increases as gravitational attraction increases nearing the earth, and the density of matter increases accordingly.  With the weight of the column of air in the atmosphere there will be the corresponding stratification of pressure..  At a specific height , if air is bottled, it will retain the pressure of that height from the nature of the molecular structure of a gas. Horizontal pressure in the atmosphere will generate winds.
To answer the title, the collisions of molecules by their impacts on a surface will create a pressure. In a closed system, as in a bottle, this pressure is constant and is applied to the walls of the container. In an open system, as with a force applied with a  piston for filling bicycle tires, pressure increases. The weight of the column of atmosphere generates pressure in this open system. If there were no gravity the atmosphere would statistically disperse as the system is open, in the end  with no molecules left to define a pressure.
A: Questions like this arise out of a confusion between cause and mechanism.
Pressure is exerted by collisions. That’s the mechanism for pressure in some particular situation. 
But what causes the particular value of the pressure is not the collisions, but rather the external situation:


*

*you put n moles of gas at temperature T in a volume V

*gas or liquid is pressed down by the weight of matter above it

*flowing fluid is constricted or expanded


The temperature and density of the fluid determine the number and momenta of the collisions providing pressure. The physical situation determines those, and there causes the resulting pressure. 
