解决Zarp报错,成功运行

1.首先Zarp不能在windows下运行,它会检查uid,uid只有linux有。
2.python环境不能小于2.7,我用的是python2.7.3(用python2.6.6会报错)

装好python2.7.3后运行Zarp会报如下错误:
ImportError: No module named 之类的错误,说明没装所需模块。
Zarp需要netlib和flask、sqlite3
要安装netlib可以用pip进行安装,然后用easy_install安装flask.

一.我的系统是centos,首先安装python2.7.3:

1、安装开发工具

yum groupinstall "Development tools"
2、安装其它需要的包

yum install zlib-devel bzip2-devel openssl-devel ncurses-devel

3、下载并解压缩 Python2.7.3

wget http://python.org/ftp/python/2.7.3/Python-2.7.3.tar.bz2
tar -jxvf Python-2.7.3.tar.bz2
4、编译安装

cd Python-2.7.3
./configure
make&&make install
ps:如果想更完美一些,将系统默认的python指向2.7版本,执行以下命令:(也可自己下载python:http://www.python.org/ftp/python/2.7.3/)

mv /usr/bin/python /usr/bin/python2.6.6
ln -s /usr/local/bin/python2.7 /usr/bin/python

由于yum依赖python2.6.6才能正常工作,必须对其进行修改

vi /usr/bin/yum
将文件头部的
#!/usr/bin/python
改成
#!/usr/bin/python2.6.6

二.安装PIP及Flask

安装pip必须先安装setuptools 
wget http://pypi.python.org/packages/2.7/s/setuptools/setuptools-0.6c11-py2.7.egg --no-check-certificate
sh setuptools-0.6c11-py2.7.egg

安装PIP 
wget http://pypi.python.org/packages/source/p/pip/pip-1.0.2.tar.gz --no-check-certificate

tar zxf pip-1.0.2.tar.gz

cd pip-1.0.2

python setup.py install

再安装netlib pip-2.7 install netlib 
(安装好pip后就带了easy_instal命令,也可用yum下载 yum -y install python-pip)

安装flask
sudo easy_install Flask

如果提示找不到sqlite3模块,需要下载下载模块,并重新编译python:

1.下载sqlite3模块http://www.sqlite.org/sqlite-amalgamation-3.6.20.tar.gz  可以安装到指定命令  ./configuser --prefix=/usr/local/sqlite3/

2.先修改python setup.py 文件
在 sqlite_inc_paths 中添加sqlite的include 路径
如:
        sqlite_inc_paths = [ ‘/usr/include‘,
                             ‘/usr/include/sqlite‘,
                             ‘/usr/include/sqlite3‘,
                             ‘/usr/local/include‘,
                             ‘/usr/local/include/sqlite‘,
                             ‘/usr/local/include/sqlite3‘,
                             ‘/usr/local/sqlite3/include‘,
                             ‘/usr/local/sqlite3/include/sqlite3‘,
                           ]

再重新安装python2.7.3即可,检测安装是否成功>>import sqlite3

解决Zarp报错,成功运行

上一篇:js解析json,js转换json成map,获取map的key,value


下一篇:基于minfs 的静态网站部署模式