簡體   English   中英

Python安裝程序無法使用pkg-config找到正確安裝的模塊

[英]Python setup does not find correctly installed module using pkg-config

首先,我不了解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在正確的位置查找。 我猜是某種原因不在正確的目錄中查找。

為了將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/

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM