我一個Ubuntu值得信賴的搬運工容器上安裝python3-tk的虛擬環境下工作。(易於得到安裝python3-TK)python3 Tkinter的Ubuntu的信賴不
> python3
Python 3.4.3 (default, Oct 14 2015, 20:28:29)
[GCC 4.8.4] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import tkinter
>>> import tkinter as tk
>>>
到目前爲止好。但是,由於不同的原因,我需要在同一個容器中運行加載的python3 virtualenv。 當我激活虛擬環境:
(env_py34)[email protected]:/home# python
Python 3.4.3 (default, Oct 14 2015, 20:28:29)
[GCC 4.8.4] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import tkinter as tk
Traceback (most recent call last):
File "/usr/lib/python3.4/tkinter/__init__.py", line 39, in <module>
import _tkinter
ImportError: No module named '_tkinter'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python3.4/tkinter/__init__.py", line 41, in <module>
raise ImportError(str(msg) + ', please install the python3-tk package')
ImportError: No module named '_tkinter', please install the python3-tk package
>>>
蟒的版本是相同的。 虛擬環境怎麼沒有從python3安裝中繼承python3-tk?我如何在虛擬環境中安裝python3-tk?
這是正確的答案,儘管@ user1256124添加了有價值的信息。 –
用於python 3.6的'sudo apt-get install python3.6-tk'。 – Morgoth