熱門文章

顯示具有 python 標籤的文章。 顯示所有文章
顯示具有 python 標籤的文章。 顯示所有文章

2016年9月22日 星期四

[文字編輯器]Sublime Text好用套件-Emmet




手動安裝可參考 :https://www.minwt.com/webdesign-dev/html/11624.html




這邊使用的是sublime2


安裝步驟

1.下載Sublime Text https://www.sublimetext.com/3


2.安裝Package Control

2-1開啟sublime 並開啟Console (位置在最上方的view > Show Console


 可以看到下方出現console
2-2 輸入相對版本的指令 https://sublime.wbond.net/installation

Sublime Text 2

import urllib2,os,hashlib; h = '261dd1222b4693ce6d4f85f9c827ac06' + '6d5ab8ebdd020086947172a8a1356bb6'; pf = 'Package Control.sublime-package'; ipp = sublime.installed_packages_path(); os.makedirs( ipp ) if not os.path.exists(ipp) else None; urllib2.install_opener( urllib2.build_opener( urllib2.ProxyHandler()) ); by = urllib2.urlopen( 'http://packagecontrol.io/' + pf.replace(' ', '%20')).read(); dh = hashlib.sha256(by).hexdigest(); open( os.path.join( ipp, pf), 'wb' ).write(by) if dh == h else None; print('Error validating download (got %s instead of %s), please try manual install' % (dh, h) if dh != h else 'Please restart Sublime Text to finish installation')
2-3 重開


3.安裝Emmet

3-1 開啟package controller  (Sublime Text2 > perferences >Package Control) 
或快捷鍵(command+shift+p)


3-2 選擇 Package Control:Install Package



3-3 Package Control 視窗會消失,請再開啟一次 (command+shift+p),並輸入emmet
選擇第一個( 並非我途中所顯示的那個,因為我已經安裝所以不會顯示)


這個才是正確的Emmet (youtube 截圖 from :https://www.youtube.com/watch?v=8n923UBjV9w)

3-4重開 !!完成




再來是操作 ,在sublime 開啟 html檔案,以下是簡易的教學影片

輸入 .[class name] 後,按鍵盤的Tab鍵 即可變成
<div class="[class name]"></div>
幫你省下許多時間






更多外掛介紹及教學

http://www.slideshare.net/banPrint/sublime-text-51689543

2016年8月8日 星期一

Python 安裝 (Mac OS X)

➜  ~ git:(master) pip

zsh: command not found: pip

沒有python


安裝homebrew

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

檢查是否安裝成功
brew -v
Homebrew 0.9.9 (git revision ed9b; last commit 2016-07-13)

安裝python3
brew install python3
==> Installing dependencies for python3: sqlite, gdbm==> Installing python3 dependency: sqlite==> Downloading https://homebrew.bintray.com/bottles/sqlite-3.13.0.el_capitan.bottle.tar.gz######################################################################## 100.0%==> Pouring sqlite-3.13.0.el_capitan.bottle.tar.gz==> CaveatsThis formula is keg-only, which means it was not symlinked into /usr/local.
OS X provides an older sqlite3.
Generally there are no consequences of this for you. If you build yourown software and it requires this formula, you'll need to add to yourbuild variables:
    LDFLAGS:  -L/usr/local/opt/sqlite/lib    CPPFLAGS: -I/usr/local/opt/sqlite/include
==> Summary🍺  /usr/local/Cellar/sqlite/3.13.0: 10 files, 2.9M==> Installing python3 dependency: gdbm==> Downloading https://homebrew.bintray.com/bottles/gdbm-1.12.el_capitan.bottle.tar.gz######################################################################## 100.0%==> Pouring gdbm-1.12.el_capitan.bottle.tar.gz🍺  /usr/local/Cellar/gdbm/1.12: 18 files, 490.7K==> Installing python3==> Downloading https://homebrew.bintray.com/bottles/python3-3.5.2.el_capitan.bottle.tar.gz######################################################################## 100.0%==> Pouring python3-3.5.2.el_capitan.bottle.tar.gz==> /usr/local/Cellar/python3/3.5.2/bin/python3 -s setup.py --no-user-cfg install --force --verbose --install-scripts=/usr/local/Cellar/python3/3.5.2/bin --install-lib=/usr/local/lib/python3.5/site-packages --si==> /usr/local/Cellar/python3/3.5.2/bin/python3 -s setup.py --no-user-cfg install --force --verbose --install-scripts=/usr/local/Cellar/python3/3.5.2/bin --install-lib=/usr/local/lib/python3.5/site-packages --si==> /usr/local/Cellar/python3/3.5.2/bin/python3 -s setup.py --no-user-cfg install --force --verbose --install-scripts=/usr/local/Cellar/python3/3.5.2/bin --install-lib=/usr/local/lib/python3.5/site-packages --si==> CaveatsPip, setuptools, and wheel have been installed. To update them  pip3 install --upgrade pip setuptools wheel
You can install Python packages with  pip3 install <package>
They will install into the site-package directory  /usr/local/lib/python3.5/site-packages
See: https://github.com/Homebrew/brew/blob/master/share/doc/homebrew/Homebrew-and-Python.md
.app bundles were installed.Run `brew linkapps python3` to symlink these to /Applications.==> Summary🍺  /usr/local/Cellar/python3/3.5.2: 3,494 files, 53.2M

測試python
pip

zsh: command not found: pip

還是沒有,結果發現因為是版本3所以要pip3

pip3

Usage:     pip <command> [options]
Commands:  install                     Install packages.  download                    Download packages.  uninstall                   Uninstall packages.  freeze                      Output installed packages in requirements format.  list                        List installed packages.  show                        Show information about installed packages.  search                      Search PyPI for packages.  wheel                       Build wheels from your requirements.  hash                        Compute hashes of package archives.  completion                  A helper command used for command completion  help                        Show help for commands.
General Options:  -h, --help                  Show help.  --isolated                  Run pip in an isolated mode, ignoring environment variables and user configuration.  -v, --verbose               Give more output. Option is additive, and can be used up to 3 times.  -V, --version               Show version and exit.  -q, --quiet                 Give less output.  --log <path>                Path to a verbose appending log.  --proxy <proxy>             Specify a proxy in the form [user:passwd@]proxy.server:port.  --retries <retries>         Maximum number of retries each connection should attempt (default 5 times).  --timeout <sec>             Set the socket timeout (default 15 seconds).  --exists-action <action>    Default action when a path already exists: (s)witch, (i)gnore, (w)ipe, (b)ackup.  --trusted-host <hostname>   Mark this host as trusted, even though it does not have valid or any HTTPS.  --cert <path>               Path to alternate CA bundle.  --client-cert <path>        Path to SSL client certificate, a single file containing the private key and the certificate in PEM format.  --cache-dir <dir>           Store the cache data in <dir>.  --no-cache-dir              Disable the cache.  --disable-pip-version-check                              Don't periodically check PyPI to determine whether a new version of pip is available for download. Implied with --no-index.



安裝requests 和 BeautifulSoup4


➜  ~ git:(master) pip3 install requests
Collecting requests
  Downloading requests-2.10.0-py2.py3-none-any.whl (506kB)
    100% |████████████████████████████████| 512kB 633kB/s 
Installing collected packages: requests
Successfully installed requests-2.10.0
➜  ~ git:(master) pip3 install BeautifulSoup4
Collecting BeautifulSoup4
  Downloading beautifulsoup4-4.5.1-py3-none-any.whl (83kB)
    100% |████████████████████████████████| 92kB 289kB/s 
Installing collected packages: BeautifulSoup4

Successfully installed BeautifulSoup4-4.5.1


將以上import到python,這邊跟上面一樣要改成"python3"

 ➜  ~ git:(master) python3
Python 3.5.2 (default, Jun 29 2016, 13:43:58) 
[GCC 4.2.1 Compatible Apple LLVM 7.3.0 (clang-703.0.31)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import requests
>>> from bs4 import BeautifulSoup
>>> 

輸入後 ctrl+Z 跳出
[2]  + 6004 suspended  python3




➜  ~ git:(master) pip3 install "ipython[notebook]"

takes few mins


開啟方法
➜  ~ git:(master) ipython notebook

會自動開啟瀏覽器 or 你可以手動 http://localhost:8888/