Python knowledge point

Source: Internet
Author: User

1. Install the Pil library on Mac.

1.1 download and install combo installer libpng & libjpeg: http://ethan.tira-thompson.com/Mac_ OS _X_Ports.html

1.2 sudo easy_install PIL

TestCode:

 
! /Usr/bin/ENV Python import imageimport osimport OS. pathimport syspath = sys. argv [1] small_path = (path [:-1] If path [-1] = '/'else path) +' _ small' if not OS. path. exists (small_path): OS. mkdir (small_path) for root, dirs, files in OS. walk (PATH): For f in files: fp = OS. path. join (root, f) IMG = image. open (FP) W, H = IMG. size IMG. resize (W/4, H/4 )). save (OS. path. join (small_path, F), "Jpeg") print fp

2. Install the MySQL driver on Mac

Reference: http://www.cnblogs.com/ken-zhang/archive/2011/05/14/2046211.html

A. sudo easy_install mysql-Python

B. Export dyld_library_path =/usr/local/MySQL/lib/

3. Install pyqt on Mac

Use brew for Installation

Brew install pyqt

If importpyqt4 fails, add export pythonpath =/usr/local/lib/python2.7/Site-packages: $ pythonpath in. bash_profile.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.