Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Python3 install with nix mess PATH

Tags:

python

nix

I installed Python 3.6 on Debian 9 with

nix-env -i python3-3.6.2

but now my python interpreter has changed from the default Python 2.7 to this Python 3.6.2:

which python
/home/user/.nix-profile/bin/python

and this breaks a lot of stuff. How can I install Python 3.6 without replacing the standard Python interpreter?


1 Answers

That's right, python3 on Nixpkgs provides python executable. The root cause of this is that user installed programs hide system-wide programs (see your PATH envvar).

You should install python2 too, and solve the priority override for python executable.

But you may be interested in nix-shell -p python3 instead, which creates temporal environment with python3 and leaves python 2 elsewhere.

like image 71
danbst Avatar answered May 07 '26 06:05

danbst