Showing posts with label Library. Show all posts
Showing posts with label Library. Show all posts

Sunday, 10 November 2013

Install psycopg2 with Postgresql

psycopg2 is a driver in python to connect python application with postgresql.

Install library in python, normal is easy with pip, easy_install but with psycopg2, I met errors in all linux and window.

With window, I can use this option:
http://tientuts.blogspot.com/2013/10/fix-some-errors-when-install-library.html

but with linux, when I install, this is a very common error:

Error: pg_config executable not found.

Please add the directory containing pg_config to the PATH

or specify the full executable path with the option:



    python setup.py build_ext --pg-config /path/to/pg_config build ...



or with the pg_config option in 'setup.cfg'.

----------------------------------------
Command python setup.py egg_info failed with error code 1 in /tmp/pip-build/psycopg2


After search google and try, this is my solution (in Centos):
Install postgresql in here: https://wiki.postgresql.org/wiki/Detailed_installation_guides
In present, the newest version of postgresql is 9.3 and we need setup PATH value for postgresql

PATH=$PATH:/usr/pgsql-9.3/bin/
pip install psycopg2


Tuesday, 29 October 2013

Fix some errors when install library Python in Window

When you install some library in pip/easy_install like pycrypto or library need pycrypto like paramiko, virtualenv ...
Always I meet this stupid error:

Unable to find vcvarsall.bat
Search google, I find some solutions like install visual studio, mingw32 ... because pip or easy_install  will download source code of library and need compiler to compile library.

Above solutions are good, but need many memory to install visual studio, mingw32 and many time to config.

Today, I will introduce a very simple way: this is install compiled library.
Search google with "pycrypto windows 2.7 setup"
We can find "Prebuilt Python Binaries for Windows"
http://www.voidspace.org.uk/python/modules.shtml

Install and use, really easy !!!

Friday, 13 September 2013

Scapy, a power network tool for Python

When working, I must meet some project with create pakage, pppoe, ping, catch, filter, authentication ... And I was introduced to learn to use scapy.
Scapy is a power opensource library/app for python.


Homepage: http://www.secdev.org/projects/scapy/

First project I met is pppoe with pap/chap authentication to connect to some bras, server and Scapy support it with automata (advanced function of scapy).

You can see here to know pppoe:

And this is a code

Chap authen


and we can use scapy with other protocols. At the present, I am not sure about Scapy, so you can go to http://networkingbodges.blogspot.com or homepage of scapy to get more information.