Python安装程序找不到使用pkg-config正确安装的模块

时间:2013-06-05 17:06:46

标签: python linux compiz

首先,我不知道python。我想这就是我遇到问题的原因。 我正在尝试从源代码构建compiz但是我坚持构建simple-ccsm。 simple-ccsm的设置是使用python和setup.py。 在安装时,它抱怨道:

Package compiz was not found in the pkg-config search path.
Perhaps you should add the directory containing 'compiz.pc'
to the PKG_CONFIG_PATH environment variable
No package 'compiz' was found

现在,PKG_CONFIG_PATH确实指向正确的文件夹。更重要的是,pkg-config也可以正确找到compiz:

pkg-config --libs compiz

它确实安装了simple-ccsm但是,当我运行它时,simple-ccsm无法抱怨

ImportError: No module named compizconfig

我已经为simple-ccsm安装了所有必需的依赖项(包括compizconfig-python绑定,这似乎可以提供上述错误) 所以,我想问一下python专家,我如何引导python查看正确的位置。我猜它在某种程度上没有找到正确的目录。

1 个答案:

答案 0 :(得分:1)

要将Python引导到正确的位置,您可能需要修补PYTHONPATH :(编辑因为链接已损坏)。

PYTHONPATH sets the search path for importing python modules:

PYTHONPATH Augment the default search path for module files. The format is 
the same as the shell’s PATH: one or more directory pathnames separated by 
os.pathsep (e.g. colons on Unix or semicolons on Windows). Non-existent 
directories are silently ignored.

In addition to normal directories, individual PYTHONPATH entries may refer 
to zipfiles containing pure Python modules (in either source or compiled 
form). Extension modules cannot be imported from zipfiles.

The default search path is installation dependent, but generally begins with 
prefix/lib/pythonversion (see PYTHONHOME above). It is always appended to 
PYTHONPATH.

An additional directory will be inserted in the search path in front of 
PYTHONPATH as described above under Interface options. The search path can 
be manipulated from within a Python program as the variable sys.path.

要设置变量,请在运行python脚本时指定它:

PYTHONPATH=/blah/whatever/ python somescript.py somecommand

或将其导出到您的Bash环境:

export PYTHONPATH=/blah/whatever/