问题
I am trying to set up the compiled version of CPython, on Ubuntu 12.04, by following the python developer guide. Even after installing the dependent packages lzma and sqlite3, build fails indicating that the dependent modules were not found. Exact Error:
*Python build finished, but the necessary bits to build these modules were not found:
_lzma _sqlite3 _tkinter
To find the necessary bits, look in setup.py in detect_modules() for the module's name.*
I could not locate the package tkinter. Appreciate any help.
回答1:
I was able to build Python 3.3
without modifying setup.py
after installing the following packages on my Ubuntu Precise box.
build-essential
zlib1g-dev
libbz2-dev
libncurses5-dev
libreadline6-dev
libsqlite3-dev
libssl-dev
libgdbm-dev
liblzma-dev
tk8.5-dev
回答2:
The lack of finding lzma and sqlite3 may be because your paths (LD_LIBRARY_PATH in particular) were incorrect. How did you install those two packages; did you use the package manager? If you installed manually, where did you install them? Also, did you install the development versions, if you used the package manager to install lzma and sqlite3? When installing from source, you'll need the development versions, so Python's source can find the necessary include files.
Further, you may have to edit setup.py
to indicate where these packages can be found.
As for tkinter: this relies on tcl/tk, so check that you have the development versions of these packages installed if you're installing python/tkinter from source.
回答3:
This works for me (Python 3.4, Ubuntu 13.04) meaning "make" completes cleanly:
sudo apt-get install build-essential python-dev libncurses*-dev \
liblzma-dev libgdbm-dev libsqlite3-dev \
libbz2-dev tk-dev
Install:
cd python3.4
make clean && ./configure && make && sudo make install
回答4:
I used the instructions here: python-on-debian-wheezy
But I also had to install tk-dev which wasn't listed there.
来源:https://stackoverflow.com/questions/12023773/python-3-3-source-code-setup-modules-were-not-found-lzma-sqlite3-tkinter