国产一级a片免费看高清,亚洲熟女中文字幕在线视频,黄三级高清在线播放,免费黄色视频在线看

打開APP
userphoto
未登錄

開通VIP,暢享免費(fèi)電子書等14項(xiàng)超值服

開通VIP
python環(huán)境搭建

from http://michaelzqm.iteye.com/blog/1841966

2013.04

一. window環(huán)境安裝

1. 安裝python 2.7.3 (win7 64)

下載python-2.7.3.amd64.msi

 設(shè)置python環(huán)境變量:D:\bin\Python27

 

2. 安裝easy_install

win7 64位系統(tǒng):下載文件

http://peak.telecommunity.com/dist/ez_setup.py

python ez_setup.py

設(shè)置easy_install 環(huán)境變量 :D:\bin\Python27\Scripts;

 

3. 安裝其他功能包

如:easy_install MySQL-python

easy_install -U DBUtils

問題解決:

.沒有g(shù)cc編譯環(huán)境

unable to find vcvarsall.bat

解決方法:安裝編譯環(huán)境(一個(gè)老外的帖子)

1)  First ofall download MinGW. Youneed g++compiler and MingW make in setup.

2)  If youinstalled MinGW for example to “C:\MinGW” then add “C:\MinGW\bin”to your PATH in Windows.(安裝路徑加入環(huán)境變量)

3)  Now startyour Command Prompt and go the directory where you have your setup.py residing.

4)  Last andmost important step:

setup.py install build --compiler=mingw32

或者在setup.cfg中加入:
[build]
    compiler = mingw32

 

 

4. 已編譯版本安裝

MySQL-python-1.2.3.win-amd64-py2.7.exe

 

5. api文檔地址 2.7

http://docs.python.org/2/py-modindex.html

 

6. python mongodb

easy_install -U pymongo

 

7. protobuf 安裝

可以用SVN從服務(wù)器上(http://protobuf.googlecode.com/svn/trunk)下載最新的protobuf。我使用的是protobuf-2.6.0。

進(jìn)入protobuf-2.4.1/vsprojects利用VS2010進(jìn)行編譯。生成的protoc.exe放到protobuf-2.6.0/src下。如果不放,后面無法安裝python版的protobuf。

編譯python版本的protobuf

在protobuf-2.6.0\python下運(yùn)行python setup.py build,然后再執(zhí)行python setup.py install。

注意:如果第3步的protoc.exe沒有放,會(huì)出現(xiàn)錯(cuò)誤找不到google\protobuf\compiler目錄。

 

 

8 . 安裝python memcache

easy_install python-memcached

 

 

二. linux環(huán)境

 1.  下載DBUtils1.1
 wget http://www.webwareforpython.org/downloads/DBUtils/DBUtils-1.1.tar.gz

 2. 解壓
 tar -xvf DBUtils-1.1.tar.gz

 3. 安裝DBUtils1.1
 cd DBUtils-1.1
 python setup.py install

 4. 安裝MySQL-python
 yum install MySQL-python

可能需要yum install mysql-devel

 

5. 安裝pip

yum install python-pip

檢查

which pip-python

 

6. poster安裝

pip install poster

 

7. protobuf

wget http://protobuf.googlecode.com/files/protobuf-2.5.0.tar.gz
 tar xvf protobuf-2.5.0.tar.gz
 cd protobuf-2.5.0
 ./configure --prefix=/usr/local/protobuf
 make
 make check
 make install
 vim /etc/profile
 export PATH=$PATH:/usr/local/protobuf/bin/
 export PKG_CONFIG_PATH=/usr/local/protobuf/lib/pkgconfig/
 source /etc/profile
 
 cd python/
 python setup.py install
 python setup.py build
 python setup.py install

 

三. 數(shù)據(jù)挖掘環(huán)境

安裝activepython,自帶了easy_install

easy_install numpy

easy_install networkx

easy_install twitter

easy_install nltk

easy_install BeautifulSoup

 

四. 安裝pil

windows64位

下載Pillow-2.0.0.win-amd64-py2.7.exe

下載地址:http://www.lfd.uci.edu/~gohlke/pythonlibs/

導(dǎo)入

windows用:from PIL import Image

linux用:import Image

 

 

centos 64位

wget "http://effbot.org/downloads/Imaging-1.1.7.tar.gz"

tar xvfz Imaging-1.1.7.tar.gz

cd Imaging-1.1.7

python setup.py build_ext -i

如果出錯(cuò):command 'gcc' failed with exit status 1,需要安裝python一個(gè)插件

yum install python-devel

如果使用pil時(shí)出錯(cuò):decoder jpeg not available,則安裝jpeg庫

yum install libjpeg-devel

下載FREETYPE2

wget "http://sourceforge.net/projects/freetype/files/freetype2/2.4.8/freetype-2.4.8.tar.gz"

tar zxvf freetype-2.4.8.tar.gz

cd freetype-2.4.8

make

make install

安裝png庫

yum install zlib zlib-devel

重新安裝

python setup.py build_ext -i

python setup.py install

 

使用:

import sys
sys.path.append("/root/Imaging-1.1.7/PIL")
import Image

 

五. 安裝python magick

window安裝

1. 下載imagemagick并安裝

http://www.imagemagick.org/script/binary-releases.php#windows

MAGICK_HOME

C:\Program Files\ImageMagick-6.7.7-Q16

2. 安裝wand

easy_install Wand

3. 示例代碼

#!/usr/bin/env python
from urllib2 import urlopen
from wand.image import Image

def dowloadImg(url):
    f = urlopen(url);
    return Image(file=f);

def resizeImg(img, width, height):
    print img.size
    img.resize(width, height)
    img.save(filename = 'temp_%s_%s.%s' % (img.width, img.height, img.format))

if __name__ == '__main__':
    img = dowloadImg('http://xxx.com/xxx.png')
    resizeImg(img,64,64)
    resizeImg(img,48,48)

 

 centos

1. 安裝imagemagick

yum update

yum  install  ImageMagick-devel

2. 安裝 Wand

pip-python install Wand

----------------------------------------------------------------------------某些環(huán)境安裝有問題,先貼安全歷史記錄命令

convert -version
python
cat /etc/profile
ls /usr/local/lib/libImage*
ls /usr/local/lib/libMagick*
yum -y remove ImageMagick
pip

a) 安裝pip
#wget  http://python-distribute.org/distribute_setup.py
#python distribute_setup.py
#wget https://github.com/pypa/pip/raw/master/contrib/get-pip.py
#python get-pip.py

wget https://bootstrap.pypa.io/ez_setup.py

python ez_setup.py

https://pypi.python.org/pypi/pip

下載最新pip,解壓

python setup.py install

vim /etc/profile

添加:

PATH=/usr/local/python27/bin:$PATH

export path

b)安裝圖庫
wget http://www.imagemagick.org/download/delegates/libpng-1.6.6.tar.gz
#wget http://www.imagemagick.org/download/delegates/libpng-1.6.2.tar.gz
tar xzvf libpng-1.6.6.tar.gz

cd libpng-1.6.2
./configure --prefix=/usr/local
make
make install
cd ..
wget http://www.imagemagick.org/download/ImageMagick.tar.gz
tar xzvf ImageMagick.tar.gz
cd ImageMagick-6.8.7-8
export CPPFLAGS=-I/usr/local/include
export LDFLAGS=-L/usr/local/lib

./configure --prefix=/usr/local --disable-static --with-modules --without-perl --without-magick-plus-plus --with-quantum-depth=8 --with-gs-font-dir=/usr/local/share/ghostscript/fonts

#wget http://hivelocity.dl.sourceforge.net/project/freetype/freetype2/2.3.11/freetype-2.3.11.tar.gz

wget http://download.savannah.gnu.org/releases/freetype/freetype-old/freetype-2.3.9.tar.gz
tar xzvf freetype-2.3.11.tar.gz
cd freetype-2.3.11
./configure --prefix=/usr/local
make
make install

wget http://www.ijg.org/files/jpegsrc.v8.tar.gz
tar xzvf jpegsrc.v8.tar.gz
cd jpeg-8
#ln -s `which glibtool` ./libtool
./configure --enable-shared --prefix=/usr/local
make
make install

也可能需要高版本的如:

    tar -xzvf jpegsrc.v9.tar.gz 
    cd jpeg-9 
    ./configure 
    make libdir=/usr/lib64  
    make libdir=/usr/lib64 install 

wget ftp://ftp.remotesensing.org/pub/libtiff/tiff-3.9.2.tar.gz
tar xzvf tiff-3.9.2.tar.gz
cd tiff-3.9.2
./configure --prefix=/usr/local
make
make install


wget http://ghostscript.com/releases/ghostscript-8.70.tar.gz
tar xzvf ghostscript-8.70.tar.gz
cd ghostscript-8.70/
./configure  --prefix=/usr/local
make
make install
cd ..
wget ftp://ftp.imagemagick.org/pub/ImageMagick/delegates/ghostscript-fonts-std-8.11.tar.gz
tar xzvf ghostscript-fonts-std-8.11.tar.gz
mv fonts /usr/local/share/ghostscript

 

c) 安裝magick
cd ImageMagick-6.8.6-2/
./configure
make
make install

 

d) 配置文件

vim /etc/profile

添加如下內(nèi)容

MAGICK_HOME=/usr/local
export MAGICK_HOME
export PATH=$PATH:/usr/local/bin:
source /etc/profile
echo 'source /etc/profile' >> ~/.bashrc
exit

 

e) 安裝wand

 pip install wand

 

f) 測試

convert -version

 

 

六 django環(huán)境部署

wget --no-check-certificate "https://pypi.python.org/packages/source/D/Django/Django-1.6.tar.gz#md5=65db1bc313124c3754c89073942e38a8"

tar xvf Django-1.6.tar.gz

cd Django-1.6

python setup.py install

django-admin.py startproject projectname

python manage.py startapp appname

python manage.py runserver 0.0.0.0:8000

 

python manage.py syncdb

python manage.py makemigrations

python manage.py migrate

 

七 redis

1. 安裝

pip install redis

 

2. 使用

import redis
r = redis.StrictRedis(host=’localhost’, port=6379, db=0)
r.set(‘foo’, ‘bar’)
r.get(‘foo’)

 

 六. mac環(huán)境搭建

1. 安裝mac  python 

2. 安裝pip,先下載https://raw.githubusercontent.com/pypa/pip/master/contrib/get-pip.py

python get-pip.py

3.  安裝MySQL-python

先下載源碼

安裝mysql-5.6.23-osx10.9-x86_64.dmg(不然會(huì)提示找不到mysql_config)

修改site.cfg :mysql_config = /usr/local/mysql/bin/mysql_config

然后(不設(shè)置會(huì)提示image not find):

 

sudo ln -s /usr/local/mysql/lib/libmysqlclient.18.dylib /usr/lib/libmysqlclient.18.dylib 

 

sudo ln -s /usr/local/mysql/lib /usr/local/mysql/lib/mysql

最后:python setup.py install

 

本站僅提供存儲(chǔ)服務(wù),所有內(nèi)容均由用戶發(fā)布,如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請(qǐng)點(diǎn)擊舉報(bào)。
打開APP,閱讀全文并永久保存 查看更多類似文章
猜你喜歡
類似文章
安裝paramiko模塊
Centos 六 上安裝python
制作python模塊安裝包(轉(zhuǎn))
Linux搭建python環(huán)境詳解
4soaplib:soaplib:pycurl,PIL模塊 組建
linux下安裝python3遇到的問題總結(jié)
更多類似文章 >>
生活服務(wù)
分享 收藏 導(dǎo)長圖 關(guān)注 下載文章
綁定賬號(hào)成功
后續(xù)可登錄賬號(hào)暢享VIP特權(quán)!
如果VIP功能使用有故障,
可點(diǎn)擊這里聯(lián)系客服!

聯(lián)系客服