bitarraypython
㈠ windows环境下怎么安装cudarray
首先,deeppy的安装是需要依赖cudarray的,所以必须先安装cudarray,下载请click here。
下载完毕之后解压,有了Makefile文件,原文中配置文件是要这么改的。
First, you should consider specifying the following environment variables. - `INSTALL_PREFIX` (default: `/usr/local`). Path where to install libcudarray. For the Anaconda python distributionthis should be `/path/to/anaconda`. - `CUDA_PREFIX` (default: `/usr/local/cuda`). Path to the CUDA SDK organized in `bin/`, `lib/`, `include/` folders. - `CUDNN_ENABLED`. Set `CUDNN_ENABLED` to `1` to include cuDNN operations in `libcudarray`.
根据我的实际情况,我的anaconda安装在/data1/NLPRMNT/sunliming,所以我的INSTALL_PREFIX改为
INSTALL_PREFIX=/data1/NLPRMNT/sunliming/anaconda
我的cuda目录是
CUDA_PREFIX = /usr/local/cuda-6.5
接着是我设置CUDNN_ENABLED
CUDNN_ENABLED = 1
# Set CUDNN_ENABLED to 1 to include cuDNN operations in libcudarray.
到了这儿配置就改好了,接着运行makemake install
显示so文件被拷贝到anaconda/lib目录下面去了,接下来还有一个很重要的工作,就是安装cudarray模块。我表示我做的时候把这一步忘记了,然后后面测试,死活都过不去,都是泪啊!python setup.py install
到这个时候安装完毕测试一下pythonimport cudarray
没有问题的话就可以装deeppy了。安装deeppy就简单多了,下载、解压、执行。python setup.py install
然后就配置好了。pip list
就能看到结果了。
abstract-rendering (0.5.1)
argcomplete (0.8.4)
astropy (1.0.1)
backports.ssl-match-hostname (3.4.0.2)
bcolz (0.8.1)
beautifulsoup4 (4.3.2)
binstar (0.10.1)
bitarray (0.8.1)
blaze (0.7.3)
blz (0.6.2)
bokeh (0.8.1)
boto (2.36.0)
cdecimal (2.3)
certifi (14.5.14)
cffi (0.9.2)
clyent (0.3.4)
colorama (0.3.3)
conda (3.10.0)
conda-build (1.11.0)
conda-env (2.1.3)
configobj (5.0.6)
cryptography (0.8)
cudarray (0.1)
Cython (0.22)
cytoolz (0.7.2)
DataShape (0.4.4)
decorator (3.4.0)
deeppy (0.1.dev0)
接下来就是测试程序了,希望没有其他问题。
㈡ windows怎么安装pybluez
今天弄了一上午的python-ldap,发现要么安装vc,要么用其他比较麻烦的方法,都比较麻烦。幸好找到这个地址:
http://www.lfd.uci.e/~gohlke/pythonlibs/
这上面有很多python第三方包的二进制安装文件,包括32位和64位的。下载安装就ok了!
包括了mysqldb,ldap等。
Index by date:
fiona
scikit-image
netcdf4
mercurial
scikits.audiolab
numba
llvmpy
python-igraph
rpy2
numpy
opencv
zope.interface
sfepy
quantlib
gdal
imread
django
psychopy
cx_freeze
msgpack
regex
cellcognition
vigra
scikit-learn
pytables
h5py
blender-mathutils
htseq
bioformats
simplejson
pyzmq
mako
simpleitk
qimage2ndarray
ujson
vlfd
libsvm
liblinear
cgkit
scipy
distribute
noise
theano
pyalembic
openimageio
pyaudio
pymca
pyamg
pgmagick
lxml
steps
sqlalchemy
cffi
biopython
python-ldap
pycurl
nipy
nibabel
pygments
mahotas
py-postgresql
pyamf
planar
holopy
pyvisa
jcc
polymode
polygon
cython
pyropes
llist
shapely
vtk
pymongo
libpython
meshpy
pandas
umysql
epydoc
coverage
cheetah
pyrxp
pybluez
pythonmagick
bsdiff4
pymssql
pymol
boost.python
orange
requests
pywcs
python-sundials
pymix
pyminuit
pylzma
pyicu
assimulo
basemap
pygraphviz
pyproj
mpi4py
spyder
pytz
pyfits
mysql-python
pygame
pycparser
twisted
pil
qutip
openexr
nipype
python-snappy
visvis
docutils
pyhdf
pyqwt
kivy
scikits.umfpack
psycopg
ets
guiqwt
veusz
pyqt
pyside
dpmix
py-fcm
scikits.hydroclimpy
smc.freeimage
scipy-stack
ipython
nose
mxbase
numexpr
pyyaml
ode
virtualenv
aspell_python
tornado
pywavelets
bottleneck
networkx
statsmodels
pylibdeconv
pyhook
lmfit
slycot
ndimage
scikits.scattpy
cvxopt
pymc
pysparse
scikits.odes
matplotlib
vpython
pycuda
pyopencl
pymvpa
pythonnet
cld
mod_wsgi
nltk
python-levenshtein
rtree
pywin32
scientificpython
sympy
thrift
pyopengl-accelerate
mdp
pyopengl
gmpy
reportlab
natgrid
scikits.vectorplot
pyreadline
milk
blosc
pycogent
pip
gevent
scons
carray
python-dateutil
jinja2
markupsafe
jsonlib
pysfml
fonttools
silvercity
console
python-cjson
pycluster
cdecimal
pytst
autopy
sendkeys
ceodbc
fipy
psutil
pyephem
pycifrw
blist
line_profiler
pydbg
bitarray
pyglet
python-lzo
faulthandler
delny
pyexiv2
ilastik
twainmole
scitools
pyspharm
casuarius
pyodbc
greenlet
nitime
pylibtiff
mmtk
pycairo
pysqlite
curses
videocapture
bazaar
nlopt
trfit
libsbml
oursql
sphinx
cellprofiler
py2exe
re2
liblas
cgal-python
pymedia
ffnet
pyfftw
libxml-python
pyfltk
pymex
pymatlab
zodb3
mmlib
pygtk
pyserial
babel
scikits.ann
scikits.delaunay
numeric
pulp
nmoldyn
pymutt
iocbio
jpype
wxpython
pybox2d
dipy
mmseg
pynifti
scikits.samplerate
scikits.timeseries
vitables
quickfix
numscons
visionegg
㈢ 如何执行python第三方包windows exe格式
python第三方包的windows安装文件exe格式, 这上面有很多python第三方包的二进制安装文件,包括32位和64位的。下载安装就ok了!
这下面有很多python第三方包的二进制安装文件,包括32位和64位的。下载安装就ok了!
包括了mysqldb,ldap等。
Index by date:
fiona
scikit-image
netcdf4
mercurial
scikits.audiolab
numba
llvmpy
python-igraph
rpy2
numpy
opencv
zope.interface
sfepy
quantlib
gdal
imread
django
psychopy
cx_freeze
msgpack
regex
cellcognition
vigra
scikit-learn
pytables
h5py
blender-mathutils
htseq
bioformats
simplejson
pyzmq
mako
simpleitk
qimage2ndarray
ujson
vlfd
libsvm
liblinear
cgkit
scipy
distribute
noise
theano
pyalembic
openimageio
pyaudio
pymca
pyamg
pgmagick
lxml
steps
sqlalchemy
cffi
biopython
python-ldap
pycurl
nipy
nibabel
pygments
mahotas
py-postgresql
pyamf
planar
holopy
pyvisa
jcc
polymode
polygon
cython
pyropes
llist
shapely
vtk
pymongo
libpython
meshpy
pandas
umysql
epydoc
coverage
cheetah
pyrxp
pybluez
pythonmagick
bsdiff4
pymssql
pymol
boost.python
orange
requests
pywcs
python-sundials
pymix
pyminuit
pylzma
pyicu
assimulo
basemap
pygraphviz
pyproj
mpi4py
spyder
pytz
pyfits
mysql-python
pygame
pycparser
twisted
pil
qutip
openexr
nipype
python-snappy
visvis
docutils
pyhdf
pyqwt
kivy
scikits.umfpack
psycopg
ets
guiqwt
veusz
pyqt
pyside
dpmix
py-fcm
scikits.hydroclimpy
smc.freeimage
scipy-stack
ipython
nose
mxbase
numexpr
pyyaml
ode
virtualenv
aspell_python
tornado
pywavelets
bottleneck
networkx
statsmodels
pylibdeconv
pyhook
lmfit
slycot
ndimage
scikits.scattpy
cvxopt
pymc
pysparse
scikits.odes
matplotlib
vpython
pycuda
pyopencl
pymvpa
pythonnet
cld
mod_wsgi
nltk
python-levenshtein
rtree
pywin32
scientificpython
sympy
thrift
pyopengl-accelerate
mdp
pyopengl
gmpy
reportlab
natgrid
scikits.vectorplot
pyreadline
milk
blosc
pycogent
pip
gevent
scons
carray
python-dateutil
jinja2
markupsafe
jsonlib
pysfml
fonttools
silvercity
console
python-cjson
pycluster
cdecimal
pytst
autopy
sendkeys
ceodbc
fipy
psutil
pyephem
pycifrw
blist
line_profiler
pydbg
bitarray
pyglet
python-lzo
faulthandler
delny
pyexiv2
ilastik
twainmole
scitools
pyspharm
casuarius
pyodbc
greenlet
nitime
pylibtiff
mmtk
pycairo
pysqlite
curses
videocapture
bazaar
nlopt
trfit
libsbml
oursql
sphinx
cellprofiler
py2exe
re2
liblas
cgal-python
pymedia
ffnet
pyfftw
libxml-python
pyfltk
pymex
pymatlab
zodb3
mmlib
pygtk
pyserial
babel
scikits.ann
scikits.delaunay
numeric
pulp
nmoldyn
pymutt
iocbio
jpype
wxpython
pybox2d
dipy
mmseg
pynifti
scikits.samplerate
scikits.timeseries
vitables
quickfix
㈣ reportlab 怎么安装
1. 先安装pip
a) https://pip.pypa.io/en/latest/installing.html
b) 获取上面网址的get-pip.py
c) 运行python get-pip.py
d) 安装完成之后 pip应用程序安装在C:\Python27\Scripts目录下,把这个路径加到path环境变量里面
e) cmd-》 输入pip -》可看到命令帮助,表示安装成功
2. 下载PIL
a) http://www.pythonware.com/procts/pil
b) 下载对应版本的文件
c) Exe文件直接安装
3. 下载Reporlab包
a) https://pypi.python.org/pypi/reportlab/
b) 取下对应python版本的whl
c) Pip install 上面取下来的文件
㈤ windows 怎么安装mmseg
今天弄了一上午的python-ldap,发现要么安装vc,要么用其他比较麻烦的方法,都比较麻烦。幸好找到这个地址: http://www.lfd.uci.e/~gohlke/pythonlibs/ 这上面有很多python第三方包的二进制安装文件,包括32位和64位的。下载安装就ok了! 包括了mysqldb,ldap等。 Index by date: fiona scikit-image netcdf4 mercurial scikits.audiolab numba llvmpy python-igraph rpy2 numpy opencv zope.interface sfepy quantlib gdal imread django psychopy cx_freeze msgpack regex cellcognition vigra scikit-learn pytables h5py blender-mathutils htseq bioformats simplejson pyzmq mako simpleitk qimage2ndarray ujson vlfd libsvm liblinear cgkit scipy distribute noise theano pyalembic openimageio pyaudio pymca pyamg pgmagick lxml steps sqlalchemy cffi biopython python-ldap pycurl nipy nibab... 今天弄了一上午的python-ldap,发现要么安装vc,要么用其他比较麻烦的方法,都比较麻烦。幸好找到这个地址:
http://www.lfd.uci.e/~gohlke/pythonlibs/
这上面有很多python第三方包的二进制安装文件,包括32位和64位的。下载安装就ok了!
包括了mysqldb,ldap等。
Index by date:
fiona
scikit-image
netcdf4
mercurial
scikits.audiolab
numba
llvmpy
python-igraph
rpy2
numpy
opencv
zope.interface
sfepy
quantlib
gdal
imread
django
psychopy
cx_freeze
msgpack
regex
cellcognition
vigra
scikit-learn
pytables
h5py
blender-mathutils
htseq
bioformats
simplejson
pyzmq
mako
simpleitk
qimage2ndarray
ujson
vlfd
libsvm
liblinear
cgkit
scipy
distribute
noise
theano
pyalembic
openimageio
pyaudio
pymca
pyamg
pgmagick
lxml
steps
sqlalchemy
cffi
biopython
python-ldap
pycurl
nipy
nibabel
pygments
mahotas
py-postgresql
pyamf
planar
holopy
pyvisa
jcc
polymode
polygon
cython
pyropes
llist
shapely
vtk
pymongo
libpython
meshpy
pandas
umysql
epydoc
coverage
cheetah
pyrxp
pybluez
pythonmagick
bsdiff4
pymssql
pymol
boost.python
orange
requests
pywcs
python-sundials
pymix
pyminuit
pylzma
pyicu
assimulo
basemap
pygraphviz
pyproj
mpi4py
spyder
pytz
pyfits
mysql-python
pygame
pycparser
twisted
pil
qutip
openexr
nipype
python-snappy
visvis
docutils
pyhdf
pyqwt
kivy
scikits.umfpack
psycopg
ets
guiqwt
veusz
pyqt
pyside
dpmix
py-fcm
scikits.hydroclimpy
smc.freeimage
scipy-stack
ipython
nose
mxbase
numexpr
pyyaml
ode
virtualenv
aspell_python
tornado
pywavelets
bottleneck
networkx
statsmodels
pylibdeconv
pyhook
lmfit
slycot
ndimage
scikits.scattpy
cvxopt
pymc
pysparse
scikits.odes
matplotlib
vpython
pycuda
pyopencl
pymvpa
pythonnet
cld
mod_wsgi
nltk
python-levenshtein
rtree
pywin32
scientificpython
sympy
thrift
pyopengl-accelerate
mdp
pyopengl
gmpy
reportlab
natgrid
scikits.vectorplot
pyreadline
milk
blosc
pycogent
pip
gevent
scons
carray
python-dateutil
jinja2
markupsafe
jsonlib
pysfml
fonttools
silvercity
console
python-cjson
pycluster
cdecimal
pytst
autopy
sendkeys
ceodbc
fipy
psutil
pyephem
pycifrw
blist
line_profiler
pydbg
bitarray
pyglet
python-lzo
faulthandler
delny
pyexiv2
ilastik
twainmole
scitools
pyspharm
casuarius
pyodbc
greenlet
nitime
pylibtiff
mmtk
pycairo
pysqlite
curses
videocapture
bazaar
nlopt
trfit
libsbml
oursql
sphinx
cellprofiler
py2exe
re2
liblas
cgal-python
pymedia
ffnet
pyfftw
libxml-python
pyfltk
pymex
pymatlab
zodb3
mmlib
pygtk
pyserial
babel
scikits.ann
scikits.delaunay
numeric
pulp
nmoldyn
pymutt
iocbio
jpype
wxpython
pybox2d
dipy
mmseg
pynifti
scikits.samplerate
scikits.timeseries
vitables
quickfix
numscons
visionegg
㈥ 用python编写一个字符串压缩程序(要求为自适应模型替代法)
你好,并掘下面是LZ777自适应压缩算法的一个简单实现,你可以看看
import math
from bitarray import bitarray
class LZ77Compressor:
"""
A simplified implementation of the LZ77 Compression Algorithm
"""
MAX_WINDOW_SIZE = 400
def __init__(self, window_size=20):
self.window_size = min(window_size, self.MAX_WINDOW_SIZE)
self.lookahead_buffer_size = 15 # length of match is at most 4 bits
def compress(self, input_file_path, output_file_path=None, verbose=False):
"""
Given the path of an input file, its content is compressed by applying a simple
LZ77 compression algorithm.
The compressed format is:
0 bit followed by 8 bits (1 byte character) when there are no previous matches
within window
1 bit followed by 12 bits pointer (distance to the start of the match from the
current position) and 4 bits (length of the match)
If a path to the output file is provided, the compressed data is written into
a binary file. Otherwise, it is returned as a bitarray
if verbose is enabled, the compression description is printed to standard output
"""
data = None
i = 0
output_buffer = bitarray(endian='big'指唤)
# read the input file
try:
with open(input_file_path, 'rb') as input_file:
data = input_file.read()
except IOError:
print 'Could not open input file ...'
raise
while i < len(data):
#print i
match = self.findLongestMatch(data, i)
if match:
# Add 1 bit flag, followed by 12 bit for distance, and 4 bit for the length
# of the match
(bestMatchDistance, bestMatchLength) = match
output_buffer.append(True)
output_buffer.frombytes(chr(bestMatchDistance >> 4))
output_buffer.frombytes(chr(((bestMatchDistance & 0xf) << 4) | bestMatchLength))
if verbose:
print "<1, %i, %i>"绝逗核 % (bestMatchDistance, bestMatchLength),
i += bestMatchLength
else:
# No useful match was found. Add 0 bit flag, followed by 8 bit for the character
output_buffer.append(False)
output_buffer.frombytes(data[i])
if verbose:
print "<0, %s>" % data[i],
i += 1
# fill the buffer with zeros if the number of bits is not a multiple of 8
output_buffer.fill()
# write the compressed data into a binary file if a path is provided
if output_file_path:
try:
with open(output_file_path, 'wb') as output_file:
output_file.write(output_buffer.tobytes())
print "File was compressed successfully and saved to output path ..."
return None
except IOError:
print 'Could not write to output file path. Please check if the path is correct ...'
raise
# an output file path was not provided, return the compressed data
return output_buffer
def decompress(self, input_file_path, output_file_path=None):
"""
Given a string of the compressed file path, the data is decompressed back to its
original form, and written into the output file path if provided. If no output
file path is provided, the decompressed data is returned as a string
"""
data = bitarray(endian='big')
output_buffer = []
# read the input file
try:
with open(input_file_path, 'rb') as input_file:
data.fromfile(input_file)
except IOError:
print 'Could not open input file ...'
raise
while len(data) >= 9:
flag = data.pop(0)
if not flag:
byte = data[0:8].tobytes()
output_buffer.append(byte)
del data[0:8]
else:
byte1 = ord(data[0:8].tobytes())
byte2 = ord(data[8:16].tobytes())
del data[0:16]
distance = (byte1 << 4) | (byte2 >> 4)
length = (byte2 & 0xf)
for i in range(length):
output_buffer.append(output_buffer[-distance])
out_data = ''.join(output_buffer)
if output_file_path:
try:
with open(output_file_path, 'wb') as output_file:
output_file.write(out_data)
print 'File was decompressed successfully and saved to output path ...'
return None
except IOError:
print 'Could not write to output file path. Please check if the path is correct ...'
raise
return out_data
def findLongestMatch(self, data, current_position):
"""
Finds the longest match to a substring starting at the current_position
in the lookahead buffer from the history window
"""
end_of_buffer = min(current_position + self.lookahead_buffer_size, len(data) + 1)
best_match_distance = -1
best_match_length = -1
# Optimization: Only consider substrings of length 2 and greater, and just
# output any substring of length 1 (8 bits uncompressed is better than 13 bits
# for the flag, distance, and length)
for j in range(current_position + 2, end_of_buffer):
start_index = max(0, current_position - self.window_size)
substring = data[current_position:j]
for i in range(start_index, current_position):
repetitions = len(substring) / (current_position - i)
last = len(substring) % (current_position - i)
matched_string = data[i:current_position] * repetitions + data[i:i+last]
if matched_string == substring and len(substring) > best_match_length:
best_match_distance = current_position - i
best_match_length = len(substring)
if best_match_distance > 0 and best_match_length > 0:
return (best_match_distance, best_match_length)
return None