- Make sure install the following package for cygwin by using Cygwin setup libxml2, libxml2-devel, libxslt, libxslt-devel, python-libxml2, python-libxslt
- If you got lots of errors about debug format:
- try to add -gdwarf-2 to CFLAGS
- export CFLAGS="-gdwarf-2"
Showing posts with label python. Show all posts
Showing posts with label python. Show all posts
Sunday, April 4, 2010
Install lxml on Cygwin
To install lxml on Cygwin you need jump through a few hoops, to save who wants to get it done smoothly, I write down the necessary steps:
Using pip, virtualenv, and virtualenvwrapper in Cygwin
I have been using pip, virtualenv, and virtualenvwrapper in Cygwin for long time, it is pretty handy to isolate my development environment for each python projects I am working on. But I still need to think about what need to be done to setup all the pip, virtualenv, and virtualenvwrapper on Cygwin. To save my time and help anybody would like to setup the stuff on Cygwin, I recorded the process as following:
- Use Cygwin setup to install Python for Cygwin.
- Install easy_install in your Cygwin: download and run ez_setup.py in Cygwin.
- Install pip by using easy_install: eazy_install pip.
- pip install virtualenv
- pip install virtualenvwrapper
- add the following lines into your ~/.bashrc
- export WORKON_HOME=/cygdrive/c/labs/virtualenvs
source /usr/bin/virtualenvwrapper_bashrc
Labels:
cygwin,
pip,
python,
virtualenv,
virtualenvwrapper
Wednesday, December 9, 2009
pip install python packages makes it easy
pip is easy_install replacement, and it is easy to use. Here are some features I recently used:
- To install something from Python Package Index, for example, Django 1.1, you just issue: pip install django, it will download it and install it.
- To see what Python Packages were installed by pip, you can use command: pip freeze, of course, you can redirect the output to a file and pass around.
- To uninstall a Python Package, for example, Django 1.1 installed in step 1, the command is: pip uninstall django.
- To install some Python Package you may run into error: No distributions at all found for xxxxx, you can supply the package file url to the pip install command, for example, if you want to install Django 0.96.5, here is the command: pip install http://www.djangoproject.com/download/0.96.5/tarball/, this one is pretty cool, if you can find the package gz file, then you can install it by using pip.
Friday, June 5, 2009
Install MySQL-python on Cygwin
After pulling my hairs and scavenging the Google, finally I succeeded installed the MySQL-python on Cygwin.
- Build MySQL on Cygwin
- Download MySQL source package from here. I was using mysql-5.0.76.tar.gz
- configure && make && make install
- Install MySQL-python on Cygwin
- Download MySQL-python . I was using 1.2.2. Unzip it.
- ./setup.py install, if you run into any problem, please have look on the readme file of the MySQL-python package. You may need to update threadSafe=False in the site.cfg file.
Wednesday, June 3, 2009
PIL error: IOError: decoder jpeg not available
After installing PIL on Cygwin, I ran into the following error while I am trying to load data from a JPEG file.
To solve this problem I did the following steps:
Remove the installed PIL from Cygwin:
rm -rf /usr/lib/python2.5/site-packages/PIL
rm /usr/lib/python2.5/site-packages/PIL.pth
Install libjpeg by using Cygwin setup.exe
Rerun PIL setup.py install.
IOError: decoder jpeg not availableTo solve this problem I did the following steps:
Remove the installed PIL from Cygwin:
rm -rf /usr/lib/python2.5/site-packages/PIL
rm /usr/lib/python2.5/site-packages/PIL.pth
Install libjpeg by using Cygwin setup.exe
Rerun PIL setup.py install.
unable to remap C:\cygwin\bin\tk84.dll
While installing PIL(Python Imaging Libary) on Cygwin, I ran into the following error:
5 [main] python 4388 C:\cygwin\bin\python.exe: *** fatal error - unable to remap C:\cygwin\bin\tk84.dll to same address as parent(0x410000) != 0
x700000
22 [main] python 4636 fork: child 4388 - died waiting for dll loading, errno 11
error: Resource temporarily unavailable
Fortunately, with the help of Google, it is easy to find an existing solution from Datahammer's blog:
c:\cygwin\bin\ash
cd /bin
./rebase -b 0x100000000 tk84.dll
Rerun the PIL setup.py install in Cygwin shell.
Update: If you run into remap error on Cygwin, you could try rebaseall
c:\cygwin\bin\ash
cd /bin
./rebaseall
5 [main] python 4388 C:\cygwin\bin\python.exe: *** fatal error - unable to remap C:\cygwin\bin\tk84.dll to same address as parent(0x410000) != 0
x700000
22 [main] python 4636 fork: child 4388 - died waiting for dll loading, errno 11
error: Resource temporarily unavailable
Fortunately, with the help of Google, it is easy to find an existing solution from Datahammer's blog:
c:\cygwin\bin\ash
cd /bin
./rebase -b 0x100000000 tk84.dll
Rerun the PIL setup.py install in Cygwin shell.
Update: If you run into remap error on Cygwin, you could try rebaseall
c:\cygwin\bin\ash
cd /bin
./rebaseall
Monday, December 1, 2008
Python recursive generator to find all the files in a directory
Just for exercise, I programed the following transverse_directory function in python to find out all the files in a directory tree in python, while trying the google treasure hunt - zip:
def transverse_directory(path):
if os.path.isdir(path):
for item in os.listdir(path):
item_path = os.path.abspath(path) + os.sep + item
for file in tranverse_directory(item_path):
yield file
else:
yield path
Wednesday, November 26, 2008
Recursive lambda implementation factorial function in Python
It is easy to implement factorial function use recursive in Python, but how do you implement it by using recursive lambda in Python? Here is my try:
fact = lambda n: (n and n-1) and n*fact(n-1) or 1
Subscribe to:
Posts (Atom)