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

2017年2月28日 星期二

Python notebook

Debug tips:

  • Print debug messages
          print('ToRemoteSpec: resolvedFetchUrl=%s' % self.resolvedFetchUrl.rstrip('/'), file=sys.stderr)


2015年7月23日 星期四

Python 的 .py 和 .pyc 檔有什麼不同 ?


Source: http://www.arthurtoday.com/2010/02/python-py-pyc.html

Python 的程式是寫在 .py 裡,也就是說, .py 檔是 Python 的原始程式碼檔案,而 Python 會在執行 .py 檔時,將 .py 的程式碼編譯成中間程式碼檔 ( byte-compiled ) 的 .pyc 檔以加快下次執行的速度。

所以,當你執行一支 .py 檔時,Python 會先看看有沒有這支 .py 檔的 .pyc 檔,如果有,而且 .py 檔的修改時間和 .pyc 檔一樣時,Python 就會讀 .pyc 檔,否則,Python 就會去讀原來的 .py 檔。

不過,執行 .py 檔並不一定會產生出 .pyc 檔,通常是被 import 的 module 的 .py 檔才會產生出 .pyc 檔的

2015年4月22日 星期三

Integrate OpenCV and Python

Install WinPython-64bit-2.7.9.4 which includes:
   Python 2.7.9   (OpenCV 2.4 supports Pythin 2.x while OpenCV 3.0 supports Python 3.x)
   NumPy 1.9.2
   SciPy 0.15.1

Copy \build\python\2.7\x64\cv2.pyd to \\Lib\site-packages

Verify (using IDEL)
   import cv2
   print (cv2.__version__)