Collectives™ on Stack Overflow
Find centralized, trusted content and collaborate around the technologies you use most.
Learn more about Collectives
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
Learn more about Teams
I compiled Python from source using:
wget http://python.org/ftp/python/2.6.6/Python-2.6.6.tar.bz2
tar jxvf Python-2.6.6.tar.bz2
cd Python-2.6.6
./configure
make install
Version of Python:
as3:~# python -V
Python 2.6.6
I also installed pip installer but when I use pip install xxx
, I always get the following error:
Traceback (most recent call last):
File "/usr/local/bin/pip", line 5, in <module>
from pkg_resources import load_entry_point
File "/usr/local/lib/python2.6/site-packages/distribute-0.6.49-py2.6.egg/pkg_resources.py", line 16, in <module>
import sys, os, time, re, imp, types, zipfile, zipimport
ImportError: No module named time
How do I fix this?
–
You need to save all the output generated by configure
in a file and check whether it tried to build the time
module and if not, then why not.
Usually, this doesn't happen because of missing header files. Fix these problems and build Python again.
If you have a package manager, then you should really consider installing Python from there: It will then come with all the dependencies and all available modules should just work.
Lastly, make sure you execute the correct executable. To check this, run Python with an absolute path. To execute it in the current folder, use $PWD/python
.
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 install
rm /usr/bin/python /usr/local/bin/python
then compile 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
nano setup.py
( add '/usr/local/lib/sqlite3/include', to the paragraph below:
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 install
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
>>> (no “ImportError: No module named _sqlite3” appears)
thus i solved the 2 errors:“ImportError: No module named _sqlite3” and
“ImportError: No module named time”
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.