Install and make tkinter work on AWS EC2 instance

后端 未结 2 1974
攒了一身酷
攒了一身酷 2021-01-19 10:21

I am desperately trying to make tkinter work on my EC2 instance.

I just want to be able to execute this line in python:

from tkinter import * 


        
相关标签:
2条回答
  • 2021-01-19 11:08

    After the previous answers I realized why it was not working so I made it work using an EC2 Ubuntu instance and doing the following:

      export DEBIAN_FRONTEND=noninteractive
      sudo -E apt-get update
      sudo -E apt-get install -y ubuntu-desktop
      sudo add-apt-repository ppa:freenx-team
      sudo apt-get update
      sudo aptitude install -y freenx
      wget https://bugs.launchpad.net/freenxserver/+bug/576359/+attachment/1378450/+files/nxsetup.tar.gz
      tar -xvf nxsetup.tar.gz
      sudo cp nxsetup /usr/lib/nx/nxsetup
      sudo /usr/lib/nx/nxsetup --install 
    

    Then said no when asked for a password and did:

      sudo vi /etc/ssh/sshd_config and set PasswordAuthentication to yes
      sudo /etc/init.d/ssh restart
      sudo passwd ubuntu
      sudo apt-get install gnome-session-fallback
    

    Once this was done I installed NX client on my local machine. All this thanks to this page

    Connected to my new server where I was able to install python-tk like that:

     sudo apt-get install python-tk
    

    And now I can use tkinter on my instance :)

    0 讨论(0)
  • 2021-01-19 11:09

    Tkinter requires a display. Unless you can somehow access a desktop on the AWS instance, you won't be able to load tkinter, much less use it.

    0 讨论(0)
提交回复
热议问题