How to check if the installed Mercurial (hg) is using Python2 or Python3?
Asked Answered
I

2

5

I wanted to install the hg-git extension with python pip but I'm not sure if I should use pip (Python2) or pip3 (Python3).

hg version gives this:

$ hg version
Mercurial Distributed SCM (version 4.8.2)
(see https://mercurial-scm.org for more information)

Copyright (C) 2005-2018 Matt Mackall and others
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Enabled extensions:

  fetch     internal
  graphlog  internal
  histedit  internal
  strip     internal
  mq        internal
  purge     internal
  rebase    internal
  record    internal
$

I first tried pip3 install hg-git and it did not work after installation. Then I used pip and it worked. Just curious how to check the Mercuial's Python version in the first place.

Inlaw answered 9/12, 2020 at 8:26 Comment(0)
C
8

Mercurial has a rather helpful command that allows you to inspect and verify the installation:

$ hg debuginstall
checking encoding (UTF-8)...
checking Python executable (/usr/local/bin/python3.7)
checking Python implementation (CPython)
checking Python version (3.7.9)
[…]
Circumference answered 2/1, 2021 at 0:37 Comment(0)
C
2

I am running Ubuntu 20.04 and on my Mercurial version (5.3.1) it is still using Python2, so I guess it should be the same. You can check it with:

$ head -1 /usr/bin/hg 
#! /usr/bin/python2

If it were something like /usr/bin/python then you could also check what version it is:

$ python --version
Python 2.7.18
Coughlin answered 9/12, 2020 at 15:25 Comment(1)
sigh. i forgot we can see the python source file.Inlaw

© 2022 - 2024 — McMap. All rights reserved.