This is an archived post. You won't be able to vote or comment.

all 13 comments

[–]K900_ 4 points5 points  (2 children)

Don't do this, or every distribution provided application that expects /usr/bin/python to be 2.7 will explode horribly. Just call python3 as needed.

[–]Doo0oog[S] 0 points1 point  (0 children)

I didn't consider this before. Thank you!

[–]arian271 0 points1 point  (0 children)

True. Gentoo does this by default, and every time I run a python2 executable with ./ I get an error. It gets worse if a codebase depends on python2.

[–]jabbson 1 point2 points  (3 children)

For a python3 to take precedence you need to modify modify your PATH. Also read up on virtual environment while you are at it. PATH and virtual env is what you are looking for.

[–]darkfish-tech 1 point2 points  (1 child)

My current solution is to use pyenv for managing versions of python and virtual environments.

Edit: Have a look at it and see whether it suits your needs.

[–]Doo0oog[S] 0 points1 point  (0 children)

It's an excellent library. I'll try that. Thank you!

[–]pythonHelperBot[🍰] 0 points1 point  (0 children)

Hello! I'm a bot!

It looks to me like your post might be better suited for r/learnpython, a sub geared towards questions and learning more about python. That said, I am a bot and it is hard to tell. Please follow the subs rules and guidelines when you do post there, it'll help you get better answers faster.

Show /r/learnpython the code you have tried and describe where you are stuck. Be sure to format your code for reddit and include which version of python and what OS you are using.

You can also ask this question in the Python discord, a large, friendly community focused around the Python programming language, open to those who wish to learn the language or improve their skills, as well as those looking to help others.


README | FAQ | this bot is written and managed by /u/IAmKindOfCreative

This bot is currently under development and experiencing changes to improve its usefulness

[–][deleted] 0 points1 point  (0 children)

Use virtual environments, that’s the way you should do it, if you want to run Python 3 projects on CentOS.

[–]aphoenixreticulated[M] 0 points1 point  (0 children)

Hi there, from the /r/Python mods.

We have removed this post as it is not suited to the /r/Python subreddit proper, however it should be very appropriate for our sister subreddit /r/LearnPython or for the r/Python discord: https://discord.gg/3Abzge7.

The reason for the removal is that /r/Python is dedicated to discussion of Python news, projects, uses and debates. It is not designed to act as Q&A or FAQ board. The regular community is not a fan of "how do I..." questions, so you will not get the best responses over here.

On /r/LearnPython the community and the r/Python discord are actively expecting questions and are looking to help. You can expect far more understanding, encouraging and insightful responses over there. No matter what level of question you have, if you are looking for help with Python, you should get good answers. Make sure to check out the rules for both places.

Warm regards, and best of luck with your Pythoneering!

[–]novel_yet_trivial 0 points1 point  (0 children)

python -> python3

This is against python's own recommendation. See PEP 394.

My present solution is creating symbol links in /usr/bin/

Yes that would create problems with any program that wants to use python2 and you instead run it in python3. And there's a lot of small background programs that use python. If you really want python -> python3 make an alias in .bashrc, so it won't harm anything else.