我想创建一个简单的python项目和nixos文档 他很有帮助。所以我有一个shell.nix文件包含以下内容的文件:
with import <nixpkgs> {};
(
python3.withPackages (ps: [ps.ipython ps.flask ps.pytest])
).env
然后我在项目文件夹上运行nixshell,一切看起来都很好。你知道吗
我的问题是,我想添加pytest bdd,但似乎 不是为NixOS打包的,因为nix search pytest bdd不返回 任何结果。你知道吗
所以我尝试表现而不是pytest bdd,因为它已经 为NixOS打包,但不幸的是behave二进制文件不是 可用,而ipython和烧瓶可用。以及的行为 应该提供二进制文件。你知道吗
所以我决定尝试一种不同的方法 遵循https://nixos.org/nixpkgs/manual/#python上的示例 (15.17.1.2.1. 打包库)。你知道吗
with import <nixpkgs> {};
(
let
my_pytestbdd = python37.pkgs.buildPythonPackage rec {
pname = "pytest-bdd";
version = "3.2.1";
src = python37.pkgs.fetchPypi {
inherit pname version;
sha256 = "1ibyr40g3p6xbx1m59as3s9spyadz8wyc7zwqyzibphrw4pkvrqp";
};
doCheck = false;
meta = {
homepage = "https://github.com/pytest-dev/pytest-bdd/";
description = "BDD library for the py.test runner";
};
};
in python37.withPackages (ps: [ps.ipython ps.flask ps.pytest ps.glob2 my_pytestbdd])
).env
我被这个信息困住了:
Processing ./pytest_bdd-3.2.1-py2.py3-none-any.whl
Collecting glob2 (from pytest-bdd==3.2.1)
ERROR: Could not find a version that satisfies the requirement glob2 (from pytest-bdd==3.2.1) (from versions: none)
ERROR: No matching distribution found for glob2 (from pytest-bdd==3.2.1)
builder for '/nix/store/d94madfidxgn5r0k9kivfidn4p2cvyjk-python3.7-pytest-bdd-3.2.1.drv' failed with exit code 1
cannot build derivation '/nix/store/ypc7hpylzvmxx8lmk5cfg8jfhrfalzgn-python3-3.7.5-env.drv': 1 dependencies couldn't be built
error: build of '/nix/store/ypc7hpylzvmxx8lmk5cfg8jfhrfalzgn-python3-3.7.5-env.drv' failed
如果您只想使用
requirements.txt
文件,可以弯曲nix以正常方式使用virtualenv,请参见默认.nix下图:然后创建一个
requirements.txt
并nix-shell
将其打开解决方案
所以在浏览了大量的文档后,我终于找到了一个 我想分享的工作方案,以避免人们像我一样的痛苦 有 经验。你知道吗
这是我的shell.nix文件文件:
运行nixshell成功地创建了环境。你知道吗
相关问题 更多 >
编程相关推荐