- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
在 Redhat 7 和 python3.6 上
我可以毫无错误地导入 tkinter:
Python 3.6.5 (default, Jul 25 2018, 21:22:33)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-28)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import tkinter
>>>
在一个新的虚拟环境中
Python 3.6.4 (default, Jul 20 2018, 12:22:32)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-28)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import tkinter
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/ocr1/CRNN_Tensorflow/tkinter/__init__.py", line 36, in <module>
import _tkinter # If this fails your Python may not be configured for Tk
ModuleNotFoundError: No module named '_tkinter'
>>>
附言这是一个全新的 virtualenv,由 virtualenv <name_of_env>
创建命令。
最佳答案
我最终找到了两种不同的方法来解决我的问题。
<强>1。确保创建的 virtualenv 使用相同的 python 版本
从我上面的例子来看,virtualenv版本的python是Python 3.6.4,但是我机器的python版本实际上是Python 3.6.5。
因此,virtualenv <name_of_env>
使用 lib
创建Python 3.6.4。要解决这个问题可以使用
virtualenv -p <PYTHON_EXE>, --python=PYTHON_EXE <name_of_env>
或
virtualenv --python=<PYTHON_EXE> <name_of_env>
指定 python exe 位置。
并使用选项 --system-site-packages
包括系统模块。 (感谢 Rob T. 上面的回答)
<强>2。从lib
复制你需要的包直接
这个方法其实有点取巧。就去机器 python lib
目录并将您需要的包复制到 virtualenv python lib
目录
例如:
cd /usr/lib/python3.6.5
cp -a ./tkinter /my_project/venv/lib/
关于python-3.x - RHEL7 导入 tkinter 在 virtualenv 中失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51981132/
已关闭。此问题不符合Stack Overflow guidelines 。目前不接受答案。 这个问题似乎不是关于 a specific programming problem, a software
刚从 vi 转到 Emacs。 我想将键盘顶部的所有数字重新绑定(bind)到它们移位的对应数字(即 1 个映射到 !,2 个映射到 @,等等),同时将数字键盘数字保持为简单数字. 我很好地重新映射了
我目前在远程主机上使用 VI,由于某种原因,一些命令映射不正确。例如当按下小写时 x ,而不是删除光标下的字符,它实际上删除了光标前两个空格的字符,因此,如果输入以下文本 BOTY 并且我将光标放在
如何更改用于在 vi 中突出显示搜索的颜色?现在黄色背景上的白色字母完全难以辨认。我宁愿它只是反转配色方案,即白色背景上的黑色字母或者黑色背景上的红色字母。但是当前的配色方案无法使用。 最佳答案 :h
我需要检索文件中字符的字符位置。我如何使用 Vi 做到这一点? 最佳答案 搜索你想要的字符: / 然后按Ctrl-g .您应该会看到类似 45,28 的内容在左下方。第二个数字是字符的位置。第一个数字
在 vi 中为一大块代码增加或减少缩进的最简单方法是什么? 最佳答案 在 vim 中(不确定这是否也适用于您),您使用 >>缩进一行。与 vim 中的几乎每个命令一样,在要执行多次的命令之前键入一个数
我无法在 shell 脚本中键入(Control A)字符。通过使用 (Ctrl+V) 然后 (Ctrl+A)。我无法这样做。 我可以从 cli 中给出 (Ctrl+A),但不能在 shell 脚本中
有没有办法在 VI 中轻松创建文本标题?我想创建一个如下所示的标题,而不必为了居中而计算字符。 # ********** a centered title ********** 有什么 vi vood
简单地说,我想做与A相反的事情。在 vi — 所以在哪里 A将您置于插入模式并将您带到当前行的末尾,我希望在当前行的开头进入插入模式。 那么,是否有等价于: 0 i 一键敲击? 我确定这之前一定有人问
是否可以使用 vi/vim 命令将数字 1-10 写在不同的行上? 最佳答案 :call append ('.', range (1, 10)) 关于vi - 在 vi 中编程,我们在Stack Ov
当使用 vi 编辑器读取长文件时,如果确实需要这样做,可以通过一些快捷方式返回到文件的开头,这是非常好的。即使 ctrl+B 有时也太慢。有人知道这样的工具吗? 最佳答案 使用 vi 打开文件后 1)
我尝试遵循以下操作: How to delete selected text in VI editor 但是 5dd 给出 E492: Not an editor command: 5dd 然后我尝试
我正在使用vi编辑器编写脚本,但是我错误地删除了一些代码行而不保存。现在我想撤消更改。我发现这样做的方法是使用u击键来撤消更改,并且效果很好。 现在我想在当前状态下退出 vi 编辑器而不保存更改,所以
我在 vi 编辑器中的复杂搜索模式中犯了一个错误,现在想修改它。 我知道 vi 会记住最后的搜索模式,但我可以查看和编辑它吗? 最佳答案 现代 vi/vim 保留 vi 中使用的 : 和 / 命令的历
我老师的笔记说 "There is a tags file that can be built which will make finding things in the kernel source
nyy yanks n 行,这是正常的行为,但是为什么 y yank 两行而 yy 仅 yanks 一行? 这对我来说听起来很违反直觉。我想知道是什么导致了这个决定。不确定 vim,因为我现在正在使用
有时,我主要用英语写作,我需要输入一个特殊的 unicode 字符,例如度数符号或希腊字母 theta。但是,记住 Unicode 十六进制值或从 Internet 复制/粘贴这两种选择都非常不令人满
所以我制作了一个脚本,它从许多不同的文件中收集数据: #!/bin/bash mkdir DATAPOOL"$1" grep achi *out>runner grep treat *out>>run
我试图在不退出 session 的情况下保存 vi session 的内容。有什么办法可以做到这一点? 最佳答案 :w 就是你要找的命令 关于linux - 在不退出 vi session 的情况下保
我读了 vim 正则表达式示例 s/vi/VIM/g 和 s:^vi$:VIM: / 和 : 有什么区别, 搜索但发现一些有用的 Material 。 最佳答案 Vim 允许您任意更改用于开始和结束搜
我是一名优秀的程序员,十分优秀!