Have `python` point at python3?


I am co-maintainer of a program that regularly calls python. I want to test python3 support but even though I was able to install python 3 globally, the python interpreter still points at python2. Notwithstanding the yml format errors (if you want to validate locally, you have to install docker, run docker, thank you but no thank you). Isn’t there any online validator where I can just copy/paste/validate ?
This is incredibly frustating as with nix, I just need to do “nix-shell -p python3” and I have python running python3.

This seems to be two questions (how to modify what python points to, and how to validate CircleCI YAML files easily). I suggest you ask one question at a time, to make it easier for helpers (and future readers too).

For your first question: there may be a Pythonic way to do this, I would just modify the path that points to the wrong Python. For example, you could do this:

PYTHON=`which python`
sudo mv $PYTHON ${PYTHON}2

Then you could do:

PYTHON3=`which python3`
sudo mv $PYTHON3 /usr/bin/python

Adjust to taste, of course.

Or if you know of a binary that works on Linux to swap Pythons, that can probably be installed via apt, in a run step.

thanks for helping, this caused other problems with missing packages.
It seems like with virtualenv
python3 -m venv HOME/venv . {HOME}/venv/bin/activate
python will point at python3 but in my case one of the activate call was from a wrong directory and silently ignored. This works now but I must confess circleci is one of my worst computer experience in the past years. Maybe it’s great with the API but the yml thing is just crazy, the doc a huge mess because of spaghetti links, myriads of options.

If you’re looking for help, I recommend you change your approach. Your posts are a mixture of snark and negativity, and that will wear down the people who read your posts. Some of us are just fellow users, and we can choose to stop helping whenever we like.

Remember, CI systems are hard. There is no out-of-the-box experience, not until someone figures out an AI to work out what you need, and then build it for you. If you are finding something difficult, don’t just blame the tools in your hand - look to improve your own skills as well. Be patient with yourself, and emit as much kindness as you can when asking for assistance.

Out of interest, have you tried any other CI systems? I tried the free tier of Travis a few years ago, and I prefer CircleCI. I should try Travis again, but I seem to recall their paid tier was too expensive. GitLab may be worth a try too, if you really don’t get on with Circle. I use them as a Docker registry, but not tried their CI.

1 Like

Using the Docker executor with a Python 3 image means python will refer to Python 3.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.