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