Installing rpm and yum in anaconda python on centos 7

How to install redhat yum packages in anaconda environment on CentOS? These packages exist in the standard Centos dist file:

$ 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')

      

I cannot find similar packages (the way I know) for 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 and search in conda also lack these packages.

+3


source to share


1 answer


When you run the source anaconda3 / bin / activate python2.7 you are using python2.7 using a different virtual environment where the package repository is different. You should go to Venv and install the packages there.



0


source







All Articles