How to get pymongo version from command prompt?

3,773 views
Skip to first unread message

aaa

unread,
Jun 23, 2015, 7:24:09 PM6/23/15
to mongod...@googlegroups.com
Using Python 2.7 on mac OS.Installed pymongo using   “pip install pymongo” successfully.

 

Stephen Steneker

unread,
Jun 24, 2015, 3:04:59 AM6/24/15
to mongod...@googlegroups.com, mitr...@gmail.com
On Wednesday, 24 June 2015 09:24:09 UTC+10, aaa wrote:
Using Python 2.7 on mac OS.Installed pymongo using   “pip install pymongo” successfully.

Hi,

There are several ways to check the installed module version.

The best approach is to confirm using the python runtime, which will load pymongo based on your current environment variables.

It's also useful to check that PyMongo has the C extensions installed as these improve serialisation performance over the pure Python implementation:

$ python -c "import pymongo; print(pymongo.version); print(pymongo.has_c())"
3.0.2
True

Alternatively you can check what version pip thinks is installed. The caveat is that different module versions might be loaded based on Python environment variables or with tools like virtualenv.

$ pip list | grep pymongo
pymongo
(3.0.2)

Regards,
Stephen

aaa

unread,
Jun 25, 2015, 11:41:17 AM6/25/15
to mongod...@googlegroups.com
Thanks Stephen,

The pymongo.has_c() returned False, would that be a big issue or can be ignored?  I am going to use this library to RobotFramework and already got some issue(Python 2.7.3).

Bernie Hackett

unread,
Jun 25, 2015, 12:01:48 PM6/25/15
to mongod...@googlegroups.com, mitr...@gmail.com
Though the pure python BSON library shipped in PyMongo 3 is much faster in many ways than what ships in PyMongo 2, you will still get better performance with the C extensions installed. See the installation docs here for rereqs if you are on a Linux machine:


For Windows or OSX there are precompiled binary packages on pypi:

Reply all
Reply to author
Forward
0 new messages