- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
安装 lxml
模块后,我的脚本在原始版本的 Ubuntu 10.10 上成功运行。 ( python 2.6.6)
所以我已经手动编译并安装了 pyhton2.7(来自源代码)。我的脚本不再有效:
Error: ImportError: No module named lxml
我已经回到python2.6.7(从源代码),但错误不断发生。调用正确的 python 版本 (2.6.7)。
注意:我在错误发生后多次删除并重新安装了软件包python-lxml
。错误仍然存在:
sudo aptitude install pyhton-lxml
我是否必须执行某种神奇的脚本才能让 python 找到模块?
下面是命令的输出:strace ./RunScriptPython.py
(使用 python -v
)
$ strace ./RunScriptPython.sh
execve("./RunScriptPython.sh", ["./RunScriptPython.sh"], [/* 38 vars */]) = 0
brk(0) = 0x9be3000
access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
mmap2(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb770c000
access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory)
open("/etc/ld.so.cache", O_RDONLY) = 3
fstat64(3, {st_mode=S_IFREG|0644, st_size=81621, ...}) = 0
mmap2(NULL, 81621, PROT_READ, MAP_PRIVATE, 3, 0) = 0xb76f8000
close(3) = 0
access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
open("/lib/libc.so.6", O_RDONLY) = 3
read(3, "\177ELF\1\1\1\0\0\0\0\0\0\0\0\0\3\0\3\0\1\0\0\0@n\1\0004\0\0\0"..., 512) = 512
fstat64(3, {st_mode=S_IFREG|0755, st_size=1421892, ...}) = 0
mmap2(NULL, 1427880, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x1d7000
mmap2(0x32e000, 12288, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x157) = 0x32e000
mmap2(0x331000, 10664, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x331000
close(3) = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb76f7000
set_thread_area({entry_number:-1 -> 6, base_addr:0xb76f78d0, limit:1048575, seg_32bit:1, contents:0, read_exec_only:0, limit_in_pages:1, seg_not_present:0, useable:1}) = 0
mprotect(0x32e000, 8192, PROT_READ) = 0
mprotect(0x805c000, 4096, PROT_READ) = 0
mprotect(0xf33000, 4096, PROT_READ) = 0
munmap(0xb76f8000, 81621) = 0
getpid() = 3006
rt_sigaction(SIGCHLD, {SIG_DFL, [CHLD], SA_RESTART}, {SIG_DFL, [], 0}, 8) = 0
geteuid32() = 905975433
brk(0) = 0x9be3000
brk(0x9c04000) = 0x9c04000
getppid() = 3005
stat64("/home/CEDROFINANCES/alexander.miro/dev/cedro/20120113_8P_Correcoes_linux/tools/bean_maker", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
stat64(".", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
open("./RunScriptPython.sh", O_RDONLY) = 3
fcntl64(3, F_DUPFD, 10) = 10
close(3) = 0
fcntl64(10, F_SETFD, FD_CLOEXEC) = 0
rt_sigaction(SIGINT, NULL, {SIG_DFL, [], 0}, 8) = 0
rt_sigaction(SIGINT, {0x8056690, ~[RTMIN RT_1], 0}, NULL, 8) = 0
rt_sigaction(SIGQUIT, NULL, {SIG_DFL, [], 0}, 8) = 0
rt_sigaction(SIGQUIT, {SIG_DFL, ~[RTMIN RT_1], 0}, NULL, 8) = 0
rt_sigaction(SIGTERM, NULL, {SIG_DFL, [], 0}, 8) = 0
rt_sigaction(SIGTERM, {SIG_DFL, ~[RTMIN RT_1], 0}, NULL, 8) = 0
read(10, "#!/bin/sh\nrm -rf ../../broker_co"..., 8192) = 325
open("../../broker_communication/beans", O_RDONLY|O_NONBLOCK|O_LARGEFILE|O_DIRECTORY|O_CLOEXEC) = 3
fcntl64(3, F_GETFD) = 0x1 (flags FD_CLOEXEC)
getdents(3, /* 3 entries */, 32768) = 48
getdents(3, /* 0 entries */, 32768) = 0
close(3) = 0
stat64("/usr/local/sbin/rm", 0xbf926940) = -1 ENOENT (No such file or directory)
stat64("/usr/local/bin/rm", 0xbf926940) = -1 ENOENT (No such file or directory)
stat64("/usr/sbin/rm", 0xbf926940) = -1 ENOENT (No such file or directory)
stat64("/usr/bin/rm", 0xbf926940) = -1 ENOENT (No such file or directory)
stat64("/sbin/rm", 0xbf926940) = -1 ENOENT (No such file or directory)
stat64("/bin/rm", {st_mode=S_IFREG|0755, st_size=46756, ...}) = 0
clone(child_stack=0, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0xb76f7938) = 3007
wait4(-1, [{WIFEXITED(s) && WEXITSTATUS(s) == 0}], 0, NULL) = 3007
--- SIGCHLD (Child exited) @ 0 (0) ---
open("../../broker_communication/fix_translation", O_RDONLY|O_NONBLOCK|O_LARGEFILE|O_DIRECTORY|O_CLOEXEC) = 3
getdents(3, /* 3 entries */, 32768) = 48
getdents(3, /* 0 entries */, 32768) = 0
close(3) = 0
clone(child_stack=0, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0xb76f7938) = 3008
wait4(-1, [{WIFEXITED(s) && WEXITSTATUS(s) == 0}], 0, NULL) = 3008
--- SIGCHLD (Child exited) @ 0 (0) ---
stat64("/usr/local/sbin/python", 0xbf926940) = -1 ENOENT (No such file or directory)
stat64("/usr/local/bin/python", {st_mode=S_IFREG|0755, st_size=4081553, ...}) = 0
clone(child_stack=0, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0xb76f7938) = 3009
wait4(-1, # installing zipimport hook
import zipimport # builtin
# installed zipimport hook
# /usr/local/lib/python2.6/site.pyc matches /usr/local/lib/python2.6/site.py
import site # precompiled from /usr/local/lib/python2.6/site.pyc
# /usr/local/lib/python2.6/os.pyc matches /usr/local/lib/python2.6/os.py
import os # precompiled from /usr/local/lib/python2.6/os.pyc
import errno # builtin
import posix # builtin
# /usr/local/lib/python2.6/posixpath.pyc matches /usr/local/lib/python2.6/posixpath.py
import posixpath # precompiled from /usr/local/lib/python2.6/posixpath.pyc
# /usr/local/lib/python2.6/stat.pyc matches /usr/local/lib/python2.6/stat.py
import stat # precompiled from /usr/local/lib/python2.6/stat.pyc
# /usr/local/lib/python2.6/genericpath.pyc matches /usr/local/lib/python2.6/genericpath.py
import genericpath # precompiled from /usr/local/lib/python2.6/genericpath.pyc
# /usr/local/lib/python2.6/warnings.pyc matches /usr/local/lib/python2.6/warnings.py
import warnings # precompiled from /usr/local/lib/python2.6/warnings.pyc
# /usr/local/lib/python2.6/linecache.pyc matches /usr/local/lib/python2.6/linecache.py
import linecache # precompiled from /usr/local/lib/python2.6/linecache.pyc
# /usr/local/lib/python2.6/types.pyc matches /usr/local/lib/python2.6/types.py
import types # precompiled from /usr/local/lib/python2.6/types.pyc
# /usr/local/lib/python2.6/UserDict.pyc matches /usr/local/lib/python2.6/UserDict.py
import UserDict # precompiled from /usr/local/lib/python2.6/UserDict.pyc
# /usr/local/lib/python2.6/_abcoll.pyc matches /usr/local/lib/python2.6/_abcoll.py
import _abcoll # precompiled from /usr/local/lib/python2.6/_abcoll.pyc
# /usr/local/lib/python2.6/abc.pyc matches /usr/local/lib/python2.6/abc.py
import abc # precompiled from /usr/local/lib/python2.6/abc.pyc
# /usr/local/lib/python2.6/copy_reg.pyc matches /usr/local/lib/python2.6/copy_reg.py
import copy_reg # precompiled from /usr/local/lib/python2.6/copy_reg.pyc
import encodings # directory /usr/local/lib/python2.6/encodings
# /usr/local/lib/python2.6/encodings/__init__.pyc matches /usr/local/lib/python2.6/encodings/__init__.py
import encodings # precompiled from /usr/local/lib/python2.6/encodings/__init__.pyc
# /usr/local/lib/python2.6/codecs.pyc matches /usr/local/lib/python2.6/codecs.py
import codecs # precompiled from /usr/local/lib/python2.6/codecs.pyc
import _codecs # builtin
# /usr/local/lib/python2.6/encodings/aliases.pyc matches /usr/local/lib/python2.6/encodings/aliases.py
import encodings.aliases # precompiled from /usr/local/lib/python2.6/encodings/aliases.pyc
# /usr/local/lib/python2.6/encodings/utf_8.pyc matches /usr/local/lib/python2.6/encodings/utf_8.py
import encodings.utf_8 # precompiled from /usr/local/lib/python2.6/encodings/utf_8.pyc
Python 2.6.7 (r267:88850, Jan 30 2012, 14:30:06)
[GCC 4.4.5] on linux2
Type "help", "copyright", "credits" or "license" for more information.
Traceback (most recent call last):
File "bean_maker.py", line 1, in <module>
from lxml import etree
ImportError: No module named lxml
# clear __builtin__._
# clear sys.path
# clear sys.argv
# clear sys.ps1
# clear sys.ps2
# clear sys.exitfunc
# clear sys.exc_type
# clear sys.exc_value
# clear sys.exc_traceback
# clear sys.last_type
# clear sys.last_value
# clear sys.last_traceback
# clear sys.path_hooks
# clear sys.path_importer_cache
# clear sys.meta_path
# clear sys.flags
# clear sys.float_info
# restore sys.stdin
# restore sys.stdout
# restore sys.stderr
# cleanup __main__
# cleanup[1] encodings
# cleanup[1] site
# cleanup[1] abc
# cleanup[1] _codecs
# cleanup[1] _warnings
# cleanup[1] zipimport
# cleanup[1] encodings.utf_8
# cleanup[1] codecs
# cleanup[1] signal
# cleanup[1] posix
# cleanup[1] encodings.aliases
# cleanup[1] exceptions
# cleanup[2] copy_reg
# cleanup[2] posixpath
# cleanup[2] errno
# cleanup[2] _abcoll
# cleanup[2] types
# cleanup[2] genericpath
# cleanup[2] stat
# cleanup[2] warnings
# cleanup[2] UserDict
# cleanup[2] os.path
# cleanup[2] linecache
# cleanup[2] os
# cleanup sys
# cleanup __builtin__
# cleanup ints: 18 unfreed ints
# cleanup floats
[{WIFEXITED(s) && WEXITSTATUS(s) == 1}], 0, NULL) = 3009
--- SIGCHLD (Child exited) @ 0 (0) ---
read(10, "", 8192) = 0
exit_group(1) = ?
最佳答案
要测试我的诊断(如下)是否正确,您可以尝试运行
/usr/bin/python ./RunScriptPython.py
(应该可以。)
请注意您发布的输出中的这一点:
import site # precompiled from /usr/local/lib/python2.6/site.pyc
导入正在查找/usr/local/lib/python2.6。这不是 Ubuntu 系统默认的 python 版本。这是本地安装。
当您安装 python-lxml 包时,它安装在/usr/lib/python2.6/中,并且可以使用/usr/bin 中的 Ubuntu 系统默认版本的 python 访问,而不是/usr/您似乎正在运行 python 的本地/bin 版本。
除非出于某种原因需要/usr/local 版本的 python,最简单的解决方案是卸载它并使用/usr/bin 版本的 python。
关于python - 在 Ubuntu 中找不到(但已安装)模块,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9082926/
我最近在我的机器上安装了 cx_Oracle 模块,以便连接到远程 Oracle 数据库服务器。 (我身边没有 Oracle 客户端)。 Python:版本 2.7 x86 Oracle:版本 11.
我想从 python timeit 模块检查打印以下内容需要多少时间,如何打印, import timeit x = [x for x in range(10000)] timeit.timeit("
我盯着 vs 代码编辑器上的 java 脚本编码,当我尝试将外部模块包含到我的项目中时,代码编辑器提出了这样的建议 -->(文件是 CommonJS 模块;它可能会转换为 ES6 模块。 )..有什么
我有一个 Node 应用程序,我想在标准 ES6 模块格式中使用(即 "type": "module" in the package.json ,并始终使用 import 和 export)而不转译为
我正在学习将 BlueprintJS 合并到我的 React 网络应用程序中,并且在加载某些 CSS 模块时遇到了很多麻烦。 我已经安装了 npm install @blueprintjs/core和
我需要重构一堆具有这样的调用的文件 define(['module1','module2','module3' etc...], function(a, b, c etc...) { //bun
我是 Angular 的新手,正在学习各种教程(Codecademy、thinkster.io 等),并且已经看到了声明应用程序容器的两种方法。首先: var app = angular.module
我正在尝试将 OUnit 与 OCaml 一起使用。 单元代码源码(unit.ml)如下: open OUnit let empty_list = [] let list_a = [1;2;3] le
我在 Angular 1.x 应用程序中使用 webpack 和 ES6 模块。在我设置的 webpack.config 中: resolve: { alias: { 'angular':
internal/modules/cjs/loader.js:750 return process.dlopen(module, path.toNamespacedPath(filename));
在本教程中,您将借助示例了解 JavaScript 中的模块。 随着我们的程序变得越来越大,它可能包含许多行代码。您可以使用模块根据功能将代码分隔在单独的文件中,而不是将所有内容都放在一个文件
我想知道是否可以将此代码更改为仅调用 MyModule.RED 而不是 MyModule.COLORS.RED。我尝试将 mod 设置为变量来存储颜色,但似乎不起作用。难道是我方法不对? (funct
我有以下代码。它是一个 JavaScript 模块。 (function() { // Object var Cahootsy; Cahootsy = { hello:
关闭。这个问题是 opinion-based 。它目前不接受答案。 想要改进这个问题?更新问题,以便 editing this post 可以用事实和引文来回答它。 关闭 2 年前。 Improve
从用户的角度来看,一个模块能够通过 require 加载并返回一个 table,模块导出的接口都被定义在此 table 中(此 table 被作为一个 namespace)。所有的标准库都是模块。标
Ruby的模块非常类似类,除了: 模块不可以有实体 模块不可以有子类 模块由module...end定义. 实际上...模块的'模块类'是'类的类'这个类的父类.搞懂了吗?不懂?让我们继续看
我有一个脚本,它从 CLI 获取 3 个输入变量并将其分别插入到 3 个变量: GetOptions("old_path=s" => \$old_path, "var=s" =
我有一个简单的 python 包,其目录结构如下: wibble | |-----foo | |----ping.py | |-----bar | |----pong.py 简单的
这种语法会非常有用——这不起作用有什么原因吗?谢谢! module Foo = { let bar: string = "bar" }; let bar = Foo.bar; /* works *
我想运行一个命令: - name: install pip shell: "python {"changed": true, "cmd": "python <(curl https://boot
我是一名优秀的程序员,十分优秀!