Python2.7 常用第三方库的安装方法

1: 安装PIL或者PILLOW的方法:

PIL是Python Imaging Library的简写,是Python中最常用的图像处理库.

如果是MAC 10.9.4系统的话, 用sudo easy_install PIL安装pil可能会出现错误,谷歌搜索的话,很多人都会出现这样那样的问题.

pillow是pil的替代品,更容易安装.pillow的最新信息可以参考这里或者中文文档

  • 安装方法:

     brew install libtiff libjpeg webp little-cms2
     sudo pip install pillow
    
  • 使用方法:在需要import Image,ImageDraw的地方用下面的语句代替

  from PIL import Image,ImageDraw

2: 安装和使用virtualenv

virtualenv 用来创建隔离的Python环境。它会创建一个拥有独立安装目录的python环境,该隔离环境不会与其他virtualenv环境共享模块(可选择是否访问全局库目录)。

  • 安装:

    pip install virtualenv
    
  • 简单使用:

    mkdir testdir
    cd testdir
    virtualenv venv --distribute #初始化
    . venv/bin/activate 激活
    deactivate 退出
    

3: MySQL安装

MySQL是目前最流行的开源数据库之一.

  • 安装:

    brew intall MySQL #系统的Mysql
    sudo ARCHFLAGS=-Wno-error=unused-command-line-argument-hard-error-in-future pip install mysql-python #python的MySQL
    
  • 使用:

    mysql.server start
    

重新安装MAC后必做的设置步骤

1: 运行RealtekRTL81xx-0_0_90.pkg,安装显卡驱动.

2: 运行MultiBeast,选择Drivers—Audio—Realtek ALCXXX—Without DST—ALC887/888b Current v100302,安装声卡驱动.

3: 运行Appstore,升级到10.9.4.

4: 安装完成,重启.

5: 点击左上苹果标志,选择打开System Preferences

  • 选择打开Network,选择Ethernet,自动获取ip变成绿色后,点击Apply

  • 选择打开Mouse,去掉Scroll direction:natural的勾选,左侧两个速度拉到最大.

  • 选择打开Desk&Screen Saver,选择Screen Saver,Start after选择Never

  • 选择打开Energy Saver, Computer sleep和Display sleep都拉到Never

  • 选择打开Keyboard,选择Modifier Keys, Option key改成Command, Command key改成Option. 选择Shortcuts—Input Sources, 勾选Select the previous input source 并将Spotlight的快捷键勾选去掉

  • 选择打开Security&Privacy,点击左下角的锁标志,输入密码,点选Allow apps download from: Anywhere, 并将Put hard disks to sleep when possible和Wake for Ethernet network access的勾选去掉

6: Mac终端添加 sublime text 3打开方式,打开终端输入命令:

    sudo ln -s "/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl" /usr/bin/subl

7: 运行Appstore,下载并安装Xcode,运行然后点击agree.然后打开终端,输入命令,用来安装Command Line Tools(命令行工具):

   xcode-select --install

8: 安装brew:

   ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

9: 安装新版的iTerm2,命令行安装zsh

sublime text插件tmpl的python模板

1
2
3
4
5
6
7
8
9
10
11
12
13
14
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Date : 2014-08-13 17:33:54
# @Author : ClutchBear (roc100year@gmail.com)
from __future__ import print_function, unicode_literals, division
from future_builtins import *
import sys
reload(sys)
sys.setdefaultencoding('UTF-8')
if __name__ == "__main__":
pass

contributions不显示在github上

最近不知道怎么搞的,hexo提交了茫茫多次到github上,但在github账号页面不显示contributions绿点.自己的努力没有显示出来,十分的不爽.
尝试各种方法解决,甚至去hexo的github页面提交issues,别人回答我说,hexo提交后就会有contributions显示的.
最后发现是.gitconfig不知道被哪个软件修改了,删掉.gitconfig配置文件.
再终端重新建立一个就行了:

1
2
git config --global user.name "你的名字"
git config --global user.email "your_email@youremail.com"

最后转帖一个高手的文章:什么样的contributions会被Github计算在内?

测试Markdown语法

简明语法

什么是 Markdown

Markdown 是一种方便记忆、书写的纯文本标记语言,用户可以使用这些标记符号以最小的输入代价生成极富表现力的文档
粗体
斜体

单行代码

https://github.com/playbear/playbear.github.io.git

多行代码

1
2
3
4
5
6
7
@requires_authorization
class SomeClass:
def __init__(self)
pass
if __name__ == '__main__':
print 'hello world'

习书记说的特别好,接下来我补充几点:

  • 第一点 这里省略一万字
  • 第二点 这里省略两万字
  • 第三点 这里省略三万字

强调 斜体 粗体
链接 描述
图片