python 使用随笔

来源:互联网 发布:十颗心大数据 编辑:程序博客网 时间:2024/06/18 03:57
'''安装python'''# Python 2.X版本中最后版本是2.7.*,将来都是3.*或者4.*# python 2.7 相关lib比较多# python官网:https://www.python.org/# window下面直接从python官网下载# linux下一般内置就有python,可能版本较低'''安装pip'''# pip 是一个命令行工具,用于安装python工具包、库文件# 安装PIP(windows / linux)方法1,windows wget工具可百度以后下载安装wget https://bootstrap.pypa.io/get-pip.pypython get-pip.py# 安装PIP(windows / linux)方法2# https://pypi.python.org/pypi/pip#downloads 下载pip-9.0.1.tar.gz # 解压进入解压后目录python setup.py install# 环境变量,目录具体要参考本机D:\Python27\Scripts;D:\Python27\# linux下安装pip,方法3:apt-get install python-pip# 升级pip,window or linuxpython -m pip install --upgrade pip'''安装selenium for python,装好以后就可以用python编程了'''# 官网 http://docs.seleniumhq.org/# 官网打不开,请用赛风翻墙把#window / linux 打开终端窗口pip install -U selenium'''安装selenium web driver'''# 官网http://docs.seleniumhq.org/download/# 将下载的webdriver放在某一个目录,比如E:\opensrc\IEDriverServer_x64_2.53.1# 将这个路径加入系统PATH中'''安装selenium IDE only for firefox'''# https://addons.mozilla.org/en-US/firefox/addon/selenium-ide/# 可以用selenium IDE进行录制'''安装firebug firepath for firefox'''# firefox的组件,可以快速定位识别界面元素,配置web自动化测试'''致命错误: Python.h:没有那个文件或目录编译中断。'''apt-get install python-dev'''imagehash setup / 图片处理识别ImageHash,包括DHash的实现以及NumPy/SciPy,ImageHash的依赖包ATLAS 3.6.0 http://math-atlas.sourceforge.net/lapback http://www.netlib.org/lapack/'''# linux 安装方法1:apt-get install liblapack-devapt-get install libatlas-devapt-get install libopenblas-devapt-get install gfortranapt-get install python-devpython setup.py install --prefix=/usr/local # linux 安装方法2:apt-get install python-numpyapt-get install python-scipy# linux 安装方法3:mkdir buildcd build../configure -b 32 -Fa alg -fPIC --with-netlib-lapack-tarfile=/cygdrive/e/opensrc/lapack-3.5.0.tgz --prefix=/cygdrive/e/opensrc/ATLAS/install/../configure -b 32 -Fa alg -fPIC --with-netlib-lapack-tarfile=/disk2/math/lapack-3.5.0.tgz --prefix=/disk2/math/atlas/install/# windows 安装方法:#1. Micorsoft Visual C++ Compiler for Python 2.7#http://www.microsoft.com/en-us/download/details.aspx?id=44266#2. 下载 http://sourceforge.net/projects/scipy/files/scipy/#scipy-0.16.0b2-win32-superpack-python2.7.exe#3. 安装pip install pillow imagehash'''python2.7 建议安装一个Micorsoft Visual C++ Compiler for Python 2.7的包http://www.microsoft.com/en-us/download/details.aspx?id=44266''''''BeautifulSoup安装http://www.crummy.com/software/BeautifulSoup/bs4/doc/'''apt-get install python-bs4pip install beautifulsoup4'''opencv setupwindows:1. download opencv:http://sourceforge.net/projects/opencvlibrary/?source=directory2. unzip3. 将Opencv安装目录下opencv\build\python\2.7\x86中的cv2.pyd复制到python安装目录Lib\site-packages下4. 试一试E:\opensrc\opencv\sources\samples\python2\linux:(opencv3.0 python2.7)apt-get install libopencv-*apt-get install python-opencvapt-get install python-numpy'''# 使用opencvpython index.py --dataset e:/img/ --index index.csvpython search.py --index index.csv --query E:/q.jpg --result-path e:/img'''imageio / ffmpegpip install imageio进入python命令行:imageio.plugins.ffmpeg.download()或者下载https://github.com/imageio/imageio-binaries/raw/master/ffmpeg/ffmpeg.win32.exe将下载后文件放C:/users/michael/local/image/''''''avconv库的安装,请参考https://github.com/jiaaro/pydub,以windows为例:a). 下载libav-i686-w64-mingw32-11.7,解压b). Add the libav .../bin folder to your PATH envvarc). pip install pydub''''''mysqldb / python 2.7windows: 1. 下载window visual c++ 9.0 for python 2.7https://www.microsoft.com/en-us/download/details.aspx?id=442662. 下载MySQL-python-1.2.5.win32-py2.7.exe (md5),安装https://pypi.python.org/pypi/MySQL-python/1.2.5linux:下载MySQL-python-1.2.5.zip https://pypi.python.org/pypi/MySQL-python/1.2.5python setup.py installmysql / python 3.*1. https://github.com/PyMySQL/PyMySQL2. download -> unzip :python setup.py install''''''dejavu,音频处理'''# setuppip install dejavu'''python2.7 requests库安装1. 下载 https://pypi.python.org/pypi/requests#downloads2. unzip / python setup.py install'''# python3.x 直接pip install requests

原创粉丝点击