15

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!

Subhamoy S.
  • 6,566
  • 10
  • 37
  • 53

2 Answers2

20

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.

aquavitae
  • 17,414
  • 11
  • 63
  • 106
8

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>
norbitwise
  • 308
  • 2
  • 7
  • Yes, that is what I have been doing lately. Thanks for the response! The python2-packagename usually works for the packages that have a long list of external dependencies. Many other popular packages (e.g., matplotlib, polygon, etc.) do not have standalone packages of their own. – Subhamoy S. May 01 '12 at 11:09
  • @SubhamoySengupta So, how did you proceed for these other packages? – Paradox Mar 16 '18 at 19:33
  • 1
    Be careful though that this will leave you with two package managers that don't know each other. Package conflicts might happen. – Mr. Wrong Jun 03 '18 at 08:51