build rpm pacakge from source
linux release
python release version
install gcc
install python-devel
install setuptools
install numpy
pandas
需要在公司的伺服器上安裝python的pandas庫,但是沒有root許可權,公司的伺服器也無法訪問外網(也是許可權問題)。伺服器上只有redhat自帶的python2.6版本。
vm建立乙個與目標一樣系統版本的虛擬機器,使用同樣版本的python,build相應的python包,然後複製到目標伺服器上的使用者檔案裡面,更新pythonpath,使其可以被訪問。
如果無法使用,則上傳source壓縮檔案到目標伺服器, 使用setup.py安裝(可能需要安裝setuotools)。
use external python package
copy mydemo.py $python_dir/lib
export pythonpath=
"/home/lestat/downloads/local/mypy/lib/python2.6/site-packages:$"
export pythonpath=
"/home/lestat/downloads/local/mypy/lib64/python2.6/site-packages:$"
>>
>
import sys
>>
"/home/lestat/downloads/mypy/lib/python2.6/site-packages/six-1.11.0-py2.6.egg"
)
rpm package$ rpm --initdb --root /home/lestat/local --dbpath /home/lestat/local/lib/rpm
rpm --root /home/username/local --dbpath /home/username/local/lib/rpm \
--relocate /usr=/home/username/local --nodeps -ivh package.rpm
error : unable to change root directory: operation not permitted
using rpm2cpio (recommended)$ wget
extract rpm file using rpm2cpio and cpio command
$rpm2cpio python-six-1.9.0-2.el6.noarch.rpm|cpio -idv
-i |restore archivetest python package using-d |create leading directories where need
-m|retain previous file modification times when creating file
-v |verbose i.e. display progress
export pythonpath
$ export pythonpath=
"/home/lestat/downloads/packages/usr/lib/python2.6/site-packages:$"
;$ export pythonpath=
"/home/lestat/downloads/packages/usr/lib64/python2.6/site-packages:$"
$ python
>>
>
import six
>>
>six.__path__
build rpm pacakge from sourcepython setup.py bdist format=rpm
error -ba : unknow option
solution: yum install rpm-build
linux release
bash-4.1$ cat /etc/redhat-release
bash-4.1$ red hat entreprise linux server release 6.9 (santiago)
python release versionbash-4.1$ rpm -q python
bash-4.1$ python-2.6.6-66.e16_8.x86_64
install gccbash-4.1$ gcc version 4.4.7 (red hat 4.4.7)
(gcc)
install python-devel
install setuptools
bash-4.1$ wget
in our case, use below version:setuptools-0.6c11-py2.6.egg
install numpy
pandas
pandas-0.8.0$ python setup.py build_ext --inplace --force
pandas-0.8.0$ python setup.py install --prefix=/home/username/local/
install dependencies
python-dateutil
pytz
numexpr
bottleneck
six
redhat離線安裝gcc rzlz wget
參考 通過securecrt上傳到linux中 securecrt 登入到虛擬機器,按alt p開啟sftp傳輸介面,輸入put指令加檔案路徑 put e gcc rpm.tar.gz 解壓tar zxvf gcc rpm.tar.gz進入資料夾 cd gcc rpm進入資料夾後挨個執行以下命令 r...
Red Hat 7 5 離線安裝python3 8
環境 映象版本 red hat 7.5 python版本 python3.8 rpm 工具包 python和rpm包 提取碼 3tft python官網其它版本 red hat 7.5映象 提取碼 pzan 首先執行安裝 gcc裡的rpm檔案 出處 開始準備安裝python3.8 首先在 usr l...
RedHat6 2離線安裝vncserver
檢測是否已安裝相應的rpm包 rpm qa grep tigervnc rpm qa grep pixman rpm qa grep libxfont 必要時候使用 force忽略軟體包及檔案的衝突 nodeps 不檢查依賴性關係 rpm ivh tigervnc server 1.1.0 5.el...