Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to find psycopg2 version number

Tags:

I installed psycopg2 on my Ubuntu Natty machine using apt-get. Now, I would like to know its version number. Can someone tell what the method to find version number for such python packages is.

like image 899
Phani Avatar asked Feb 21 '12 18:02

Phani


People also ask

Does psycopg2 work with Python 3?

The current psycopg2 implementation supports: Python 2 versions from 2.6 to 2.7. Python 3 versions from 3.2 to 3.6. PostgreSQL server versions from 7.4 to 9.6.

How do I install psycopg2 on Windows 10?

To install this module follow the below steps. If python is not installed in your system, then you can install it running the given command in your command prompt. Step 2: Open the command prompt and run the below command to install psycopg2-binary. If it shows successfully installed then you are good to go.

What is the difference between psycopg2 and psycopg2-binary?

psycopg2-binary and psycopg2 both give us the same code that we interact with. The difference between the two is in how that code is installed in our computer.


1 Answers

Since you installed it with the package manager, you can get the version from the command line with this command:

dpkg -s psycopg2 

Alternatively you can get the version from using pip, if you have that installed

pip freeze | grep psycopg2 

Or just run a python command to tell you:

python -c "import psycopg2; print(psycopg2.__version__)" 

Output examples:

λ > pip freeze | grep psycopg2 psycopg2==2.4.4  λ > python -c "import psycopg2; print(psycopg2.__version__)" 2.4.4 (dt dec pq3 ext) 
like image 108
逆さま Avatar answered Sep 19 '22 13:09

逆さま