Eno
Eno

Reputation: 10860

How to build Python3 WITHOUT support for tk?

Basically I want to build a minimal version of Python 3 (this will be running on a headless server, so no GUI, no mouse, no keyboard). The dependency on tk for most Python packages pulls in X and bunch of other UI things I dont want.

There's nothing in ./configure --help that tells me how to switch off building with tk. And nothing in the README file included with the source tarball either. Its been surprisingly hard to find info about this, so what kind of spell is needed ?

Upvotes: 11

Views: 2112

Answers (2)

Fredrick Brennan
Fredrick Brennan

Reputation: 7357

It's not so complicated, just change the build file Modules/Setup as such:

Modules/Setup

diff --git a/Modules/Setup b/Modules/Setup
index 8fe7951278..dabdcc6212 100644
--- a/Modules/Setup
+++ b/Modules/Setup
@@ -300,3 +300,7 @@ PYTHONPATH=$(COREPYTHONPATH)
 #
 # _sqlite3 _tkinter _curses pyexpat
 # _codecs_jp _codecs_kr _codecs_tw unicodedata
+#
+*disabled*
+
+_tkinter

Upvotes: 3

Ethan Furman
Ethan Furman

Reputation: 69248

If the server you are trying to build Python on does not have tcl/tk installed, then Python will skip that portion during its build process.

Upvotes: 1

Related Questions