编辑:Solution
我有一个python脚本,我需要通过运行python3 myscript.py来运行这个脚本,但是我得到了这样的消息:
python3: command not installed. Multiple versions of this command were found in Nix.然后,当选择.out时,python就会启动。
我发现我需要将python3添加到.nix中,这样如果输入python3,nix就可以自动运行python39Full,从而跳过上面的消息。
Add 'python39Full' to replit.nix if you want to install 'python3' in this repl.不幸的是,我不知道如何将包添加到.nix中,所以谁能告诉我如何向.nix添加包吗?谢谢。
(如果您需要查看.nix文件)
replit.nix
{ pkgs }: {
deps = [
pkgs.bashInteractive
];
}发布于 2022-01-05 19:11:06
幸运的是,我找到了一种将包添加到.nix (至少在复制上)的方法:
如果您想跳过以下消息:
python3: command not installed. Multiple versions of this command were found in Nix.
Select one to run (or press Ctrl-C to cancel):
>
qtile.out
python39Full.out
python38Full.out
python3Minimal.out
python310.out
python37Full.out
python37.out
python38.out
sourcehut.python.out
python36.outreplit.nix
{ pkgs }: {
deps = [
pkgs.bashInteractive
];
}replit.nix
{ pkgs }: {
deps = [
pkgs.bashInteractive
python39Full.out
];
}replit.nix
{ pkgs }: {
deps = [
pkgs.bashInteractive
pkgs.python39Full
];
}python3时,nix不会每次都问您,它会自动为您启动python3.9。Demo
john@doe:~$ python3
Python 3.9.6 (default, Jun 28 2021, 08:57:49)
[GCC 10.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> https://stackoverflow.com/questions/70596677
复制相似问题