Re: [Question] Moving from Python2 to Python3

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



git-p4 is designed to work both with Python 2 and Python 3.

However, changing just PYTHONPATH may not to be good enough.

In general, it is necessary to make having PYTHONPATH value and the version of Python executable which application is run by, to be coherent: Python executable has to be able to work correctly with the libraries PYTHONPATH points to.

How to achieve it - depends on the OS where git-p4 is run.

If used from *nix like shells, git-p4 would be using Python executable from the shebang in the beginning of the file: #!/usr/bin/python . On Windows, it is possible that the specific Python executable could be associated with .py files so that shebang maybe not in play at all.

Some OSes may require manual adjustments such as setting PYTHONPATH shell profile (environment variables, for Windows) and ensuring proper Python executable will be put in PATH. Some (Linux) may use update-alternatives commands to switch between Python (and other applications) versions easier. If it is desired to keep default Python of one version and run git-p4 with another, more tweaks/hackery may be needed.

I would recommend to refer to the documentation on the specific OS and also look for hints in Python related online documentation/forums.

On 3/25/25 17:31, brian m. carlson wrote:
On 2025-03-25 at 15:23:40, rsbecker@xxxxxxxxxxxxx wrote:
Hi Git Team,

I have Python2 and Python3 on my system. We are deprecating Python2 ASAP. Is
there an easy way to force git
to use Python3 only? Both are in /usr/bin. python has a symbolic link to
python2 right now, but we are probably
going to change that. I already have modified settings in config.mak.uname
PYTHON_PATH = /usr/bin/python3.
I think only git-p4 uses Python in our codebase, so changing `PYTHON_PATH`
should be sufficient to fix it.  As far as I know, git-p4 currently
supports both, so things should just work.

Of course, I might be mistaken, since I don't use git-p4.




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux