安装pyspider

参考网址:

http://snapshot.sogoucdn.com/websnapshot?ie=utf8&url=http%3A%2F%2Fcuiqingcai.com%2F2443.html&did=2b4908cb48991f78-39d22ab878f20ebb-14ef5b97b78faa9c7aae35b689253e80&k=a0fa0d721e334c2794e3453794e04904&encodedQuery=pyspider%20%E5%AE%89%E8%A3%85&query=pyspider%20%E5%AE%89%E8%A3%85&&hdq=AQxRG-4437&duppid=1&cid=&w=01020400&m=0&st=1

 

http://www.cnblogs.com/panliu/p/4524157.html

 

出现问题

         ImportError: module _sqlite3

 

我们在安装一些基于Python的程序时,经常遇到“ImportError: No module named _sqlite3”问题。

解决办法:需先编译sqlite3.

wget http://www.sqlite.org/sqlite-amalgamation-3.6.20.tar.gz

tar zxvf  sqlite-amalgamation-3.6.20.tar.gz

cd  sqlite-3.5.6

./configure –prefix=/usr/local/lib/sqlite3

make

make install  (这样,sqlite3编译完成)

rm /usr/bin/python /usr/local/bin/python

 

再来编译python2.7:

wget http://python.org/ftp/python/2.7.6/Python-2.7.6.tar.bz2

tar jxvf  Python-2.7.6.tar.bz2

cd  Python-2.7.6

 

 

先修改Python-2.7.6目录里的setup.py 文件:

在下面这段的下一行添加’/usr/local/lib/sqlite3/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/lib/sqlite3/include’,

 

 

然后

./configure

make

make install  (这样,python2.7编译完成)

as3:~/Python-2.7.6# python -V

Python 2.7.6

as3:~/Python-2.7.6# python

Python 2.7.6 (default, Nov 20 2013, 07:15:04)

[GCC 4.4.5] on linux2

Type "help", "copyright", "credits" or "license" for more information.

>>> import sqlite3

>>>                      (此处无“ImportError: No module named _sqlite3”的出错提示,表明导入sqlite3成功)

 

 

同时也解决了“ImportError: No module named time”问题。

编译完python后,会提示:

Python build finished, but the necessary bits to build these modules were not found:

_tkinter bsddb185 bz2

gdbm readline sunaudiodev

To find the necessary bits, look in setup.py in detect_modules() for the module’s name.解决办法也是修改Python-2.7.6目录里的setup.py 文件。

 

参考:

http://cache.baiducontent.com/c?m=9f65cb4a8c8507ed4fece7631046893b4c4380146d96864968d4e414c42246064565e3bc2c291b0ed9d82f2747f41802bded602571507be9dad58e41daba952d248f33712d5cd04e498c5bf28b0032c050c71aa9f259f0bb802592ddc5d3ae080edd537425dda6cc045703ca1eac476eb4f08e48644817cefa3115be1a2972d97457b737f8&p=c262c015d9c040ae02b1c7710f009c&newp=9b759a46d7c209b34bb4c7710f5488231610db2151d7db176b82c825d7331b001c3bbfb423231a0ed5c27c6302ae4c5ee0f13576330621a3dda5c91d9fb4c57479c03b2729&user=baidu&fm=sc&query=ImportError%3A+No+module+named+%5Fsqlite3&qid=dc1ec405001403d7&p1=7

posted @ 2017-02-28 16:09  猪啊美  阅读(333)  评论(0)    收藏  举报