問題描述
我們在 Ubuntu/Macs 上開發(fā)并將 RPM 部署到 CentOS(這是設(shè)置,不能更改太多).
We develop on Ubuntu/Macs and deploy RPMs to CentOS (this is the settings, can't be changed much).
問題在于,從 rpm 安裝時,軟件包會轉(zhuǎn)到 /usr/local/lib/python2.7/dist-packages
(這是 Ubuntu 的正確位置).然而,CentOS 中的默認 python 路徑是查看 /usr/local/lib/python2.7/site-packages
.
The problem is that when installing from the rpm, the packages go to /usr/local/lib/python2.7/dist-packages
(which is the right location for Ubuntu). However the default python path in CentOS is looking at /usr/local/lib/python2.7/site-packages
.
有沒有辦法告訴 bdist_rpm 將文件安裝到哪里?
Is there a way to tell bdist_rpm where to install the files to?
推薦答案
您可以使用 setup.cfg
文件來覆蓋 Python lib 安裝路徑:
You can use a setup.cfg
file to override the Python lib install path:
setup.cfg:
[install]
install-lib=/usr/local/lib/python2.7/site-packages
例子:
% python setup.py bdist_rpm
% rpm -qpl dist/foo-0.0.0-1.noarch.rpm | grep foo
/usr/local/lib/python2.7/site-packages/foo/__init__.py
/usr/local/lib/python2.7/site-packages/foo/__init__.pyc
這篇關(guān)于bdist_rpm 從 Ubuntu 到 CentOs的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!