2017-05-03 4 views
3

Wie installiere ich die Redhat Yum-Pakete in einer Anaconda-Umgebung auf CentOS? Diese Pakete gibt es in der Standard Centos dist:Installieren von rpm und yum in anaconda python auf centos 7

$ lsb_release -d 
Description: CentOS Linux release 7.3.1611 (Core) 
$ python 
Python 2.7.5 (default, Nov 6 2016, 00:28:07) 
Type "help", "copyright", "credits" or "license" for more information. 
>>> import rpm 
>>> import yum 
>>> print(rpm.__package__, rpm.__file__, rpm.__path__,rpm.__version__) 
('rpm', '/usr/lib64/python2.7/site-packages/rpm/__init__.pyc', ['/usr/lib64/python2.7/site-packages/rpm'], '4.11.3') 
>>> print(yum.__package__, yum.__file__, yum.__path__,yum.__version__) 
('yum', '/usr/lib/python2.7/site-packages/yum/__init__.pyc', ['/usr/lib/python2.7/site-packages/yum'], '3.4.3') 

ich nicht ähnliche Pakete finden (in der Art und Weise, die ich kenne) für anaconda:

$ source anaconda3/bin/activate python2.7 
[GCC 4.4.7 20120313 (Red Hat 4.4.7-1)] on linux2 
Type "help", "copyright", "credits" or "license" for more information. 
Anaconda is brought to you by Continuum Analytics. 
Please check out: http://continuum.io/thanks and https://anaconda.org 
>>> import rpm; 
Traceback (most recent call last): 
File "<stdin>", line 1, in <module> 
ImportError: No module named rpm 
>>> import yum 
Traceback (most recent call last): 
File "<stdin>", line 1, in <module> 
ImportError: No module named yum 
>>> 

pip und Conda Suche scheinen nicht zu Habe diese Pakete auch.

Antwort

0

Wenn Sie die Quelle anakonda3/bin/activate python2.7 ausführen, führen Sie python2.7 mit einer anderen virtuellen Umgebung aus, in der sich das Paket-Repository unterscheidet. Du solltest in das venv einsteigen und dort die Pakete installieren.

+0

Danke, das verstehe ich. Aber ich verstehe nicht, wo das Paket zu finden ist, außer aus einer .rpm-Datei. Und ich verstehe nicht, wie man das in die Anaconda-Umgebung einbaut. –

+0

Das hängt davon ab, wie der virtualenv erstellt wurde. Einige der Optionen erlauben es Ihnen, die Systempakete zu kopieren, aber wenn rpm nach der Erstellung des Ventures installiert wurde, wird es später nicht synchronisiert. – jvaquero

Verwandte Themen