Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to install python2.7 specific packages on Arch Linux?

I am building an Arch Linux system from scratch, and presently there is no Python in the system. I could install Python2.7 by using this command:

pacman -S python2

But when I try to install some package for python like this:

pacman -S python-numpy

Pacman only shows option to download Python3.x and numpy for Python3.x. There is no other option available. How can I make sure that when I search for Python stuff, it only searches based on which Python version I have installed? There is no Python3 in my system and I have no need of it at all. In my Ubuntu system, I do not specify the Python version but it is always taken care of. I have no clue how to handle this in Arch Linux.

Thanks in advance!

like image 928
Subhamoy S. Avatar asked Feb 27 '12 17:02

Subhamoy S.


People also ask

How do I install Python modules in Arch Linux?

There are several ways to install Python packages on Arch Linux: Official repositories and AUR — A large number of popular packages are available in the Arch repositories. This is the preferred way to install system-wide packages. pip(1) — The official package installer for Python.

How do I install Python packages to a specific version?

How do I Install a Specific Version of a Python Package? To install a specific version of a Python package you can use pip: pip install YourPackage==YourVersion . For example, if you want to install an older version of Pandas you can do as follows: pip install pandas==1.1.


2 Answers

In Arch Linux the default Python version is 3, so all python-* packages (including python itself) are for Python3. Fortunately Python2 is still fully supported, they are just prefixed with python2-* instead. So to install numpy you would do pacman -S python2-numpy.

like image 91
aquavitae Avatar answered Oct 09 '22 10:10

aquavitae


Also if you want to download the packages specific to python2.7 from Python Package Index you'll have to use pip2. e.g.:

sudo pip2 install <package name>
like image 8
norbitwise Avatar answered Oct 09 '22 11:10

norbitwise