Closed
Description
Currently, this is the first line in x.py
.
#!/usr/bin/env python
However, on linux since it is python3
by default when you install python (at least on centos), I have to manually change it to this every time I clone this repository.
#!/usr/bin/env python3
Is there some way that there is an automated way to detect this? If not, maybe you can update the docs because it took me a while to figure out what was going wrong.
Metadata
Metadata
Assignees
Type
Projects
Milestone
Relationships
Development
No branches or pull requests
Activity
tesuji commentedon Aug 2, 2020
Do you mean that by default CentOS use python as python3?
Mark-Simulacrum commentedon Aug 2, 2020
There is unfortunately not a universal python shebang - windows never has python3 IIRC, and Ubuntu at least doesn't by default have a python these days.
If you have concrete proposals on how to make this work, I would love to hear them - a compiler team MCP is the way to go to propose such a change.
mati865 commentedon Aug 2, 2020
@nishantc1527 You can either use
python3 x.py
or set python3 as the default version using this official guide: https://developers.redhat.com/blog/2018/11/14/python-in-rhel-8/K900 commentedon Aug 2, 2020
#!/usr/bin/env python3
should be a universal shebang for Python 3 specifically - I'm not aware of any distributions that actively remove thepython3
symlink, and the Windows launcher understands it as well.mati865 commentedon Aug 2, 2020
@K900 Rust supports both Python 2 and Python 3.
nishantc1527 commentedon Aug 2, 2020
If there isn't an automated way to detect this (at least I can't thing of anything), then can the team update the documentation on how to install rust from source? It took me a while to figure out what was happening, and I believe someone smarter than me (which includes a lot of people) can get confused to.
RalfJung commentedon Aug 7, 2020
Cc #71818: latest Ubuntu also does not have
python
any more by default, it seems.So longer-term, I think it is clear that this should become
python3
eventually, as more and more distros no longer install Python 2 by default. The question is when is the right time for Rust to switch its shebang.K900 commentedon Aug 7, 2020
An alternative option would be to provide some sort of a wrapper script (
./x.sh
?) that effectively just doesjyn514 commentedon Aug 18, 2020
Closing as duplicate of #71818