我想知道尼克斯是怎么工作的。为此,我尝试创建一个简单的环境来运行jupyter笔记本电脑。在
当我运行命令时:
nix-shell -p "\
with import <nixpkgs> {};\
python35.withPackages (ps: [\
ps.numpy\
ps.toolz\
ps.jupyter\
])\
"
我得到了我所期望的——在一个安装了python和列出的所有包的环境中的一个shell,以及在路径中可以访问的所有预期命令:
^{pr2}$因此,我用一个default.nix
文件创建了一个新文件夹,其中包含以下内容:
with import <nixpkgs> {};
python35.withPackages (ps: [
ps.numpy
ps.toolz
ps.jupyter
])
但是,当我在这个文件夹中运行nix-shell
时,似乎所有的东西都安装好了,但是没有设置{
[nix-shell:~/dev/hurricanes]$ which python
/usr/bin/python
[nix-shell:~/dev/hurricanes]$ which jupyter
[nix-shell:~/dev/hurricanes]$ jupyter
The program 'jupyter' is currently not installed. You can install it by typing:
sudo apt install jupyter-core
我认为这两种情况是等价的。我做错什么了?在
当使用
nix-build
调用时,default.nix
文件应该包含生成派生的信息。当用nix-shell
调用它时,它只是以一种可以构建派生的方式设置shell。{cd4>中列出的所有属性都包含在属性中:在这里,我已经注释掉了
src
属性,如果您想运行nix-build
,那么这个属性是必需的,但是当您正在运行nix-shell
时,这个属性是不必要的。在在你最后一句话中,我想你指的是更确切地说: https://github.com/NixOS/nixpkgs/blob/master/doc/languages-frameworks/python.section.md#load-environment-from-nix-expression 我不明白这个建议:在我看来,这完全是假的。在
相关问题 更多 >
编程相关推荐