TKinter in a Virtualenv

前端 未结 9 1715
北荒
北荒 2020-12-05 00:27

Trying to run python code with TKinter-based widgets from a virtualenv.

    user@computer:~/myproject$ env/bin/python Python
    2.7.3 (default, Sep 26 2012,         


        
9条回答
  •  遥遥无期
    2020-12-05 01:06

    clone the cpython project

    git clone git@github.com:python/cpython.git
    

    cd to the cpython directory. git checkout the desired version of your virtual env(for me it is 3.4), and build it with

    ./configure
    make
    make test
    sudo make install
    

    you will find an so file _tkinter.cpython-xxx.so in a subdir of the build/ directory, copy it to your venv's lib-dynload dir. (for me it is ~/tf1.1py3.4/lib/python3.4/lib-dynload/)

提交回复
热议问题