Sample Header Ad - 728x90

How to change the default (binary) python version in a FreeBSD jail?

3 votes
1 answer
4132 views
In a jail, I have installed python3.6 along python3.4. Both were installed using pkg install, no ports. I want to keep the 3.4 version for some time, but set the 3.6 as default. Answers found in internet, like [this one](https://stackoverflow.com/questions/9349831/how-to-set-python-version-by-default-in-freebsd) or [this one](https://unix.stackexchange.com/questions/254660/freebsd-using-python3-in-uwsgi-instead-of-python2) either involve to myself link /usr/local/bin/python to python3.6 (what must be done again after any upgrade of the default python, what I'd like to avoid; plus there's no such link anyway); or to set DEFAULT_VERSIONS in /etc/make.conf, what has no effects on binaries installation (I've tried, nevertheless). Moreover, the virtual environment is not an option, since I want to run uwsgi, what requires the *system wide* default python to match the one in the python virtual environment of the python application it "monitors" (in my case, Django), in order to start correctly. Even if I start from inside the Django's virtual environment (providing python3.6), uwsgi detects python3.4 as the default python version. Cannot find if there is any environment variable missing neither. For information, inside the jail (and virtual environment): # printenv USER=root LOGNAME=root HOME=/root SHELL=/bin/csh BLOCKSIZE=K MAIL=/var/mail/root PATH=/usr/local/venv/dj1/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/games:/usr/local/sbin:/usr/local/bin:/root/bin TERM=xterm-256color HOSTTYPE=FreeBSD VENDOR=amd OSTYPE=FreeBSD MACHTYPE=x86_64 SHLVL=1 PWD=/var/log GROUP=wheel HOST=dev_web0 EDITOR=vi LANG=fr_FR.UTF-8 MM_CHARSET=UTF-8 PAGER=more VIRTUAL_ENV=/usr/local/venv/dj1
Asked by zezollo (141 rep)
May 3, 2017, 02:52 PM
Last activity: Jun 27, 2025, 08:04 AM