diff options
author | Daiderd Jordan <daiderd@gmail.com> | 2019-12-17 15:26:06 +0100 |
---|---|---|
committer | Daiderd Jordan <daiderd@gmail.com> | 2019-12-17 16:42:18 +0100 |
commit | 01591517053f759a2b5eccd43ecccea108aa0f06 (patch) | |
tree | 03c30897eb283afc90c6df304d105ccfd69fc1f8 /doc | |
parent | a5e98ed7cf88b380db42e885ba3f8ec2bdef7425 (diff) | |
download | nixpkgs-01591517053f759a2b5eccd43ecccea108aa0f06.tar nixpkgs-01591517053f759a2b5eccd43ecccea108aa0f06.tar.gz nixpkgs-01591517053f759a2b5eccd43ecccea108aa0f06.tar.bz2 nixpkgs-01591517053f759a2b5eccd43ecccea108aa0f06.tar.lz nixpkgs-01591517053f759a2b5eccd43ecccea108aa0f06.tar.xz nixpkgs-01591517053f759a2b5eccd43ecccea108aa0f06.tar.zst nixpkgs-01591517053f759a2b5eccd43ecccea108aa0f06.zip |
manual: specify interpreter in virtualenv shell
Without this virtualenv might try to setup an environment for a different version of python then the one specified in the expression.
Diffstat (limited to 'doc')
-rw-r--r-- | doc/languages-frameworks/python.section.md | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/doc/languages-frameworks/python.section.md b/doc/languages-frameworks/python.section.md index 1bedebd1190..9cb0e1eecc1 100644 --- a/doc/languages-frameworks/python.section.md +++ b/doc/languages-frameworks/python.section.md @@ -1034,7 +1034,10 @@ Create this `default.nix` file, together with a `requirements.txt` and simply ex ```nix with import <nixpkgs> {}; -with python27Packages; + +let + pythonPackages = python27Packages; +in stdenv.mkDerivation { name = "impurePythonEnv"; @@ -1044,9 +1047,8 @@ stdenv.mkDerivation { buildInputs = [ # these packages are required for virtualenv and pip to work: # - python27Full - python27Packages.virtualenv - python27Packages.pip + pythonPackages.virtualenv + pythonPackages.pip # the following packages are related to the dependencies of your python # project. # In this particular example the python modules listed in the @@ -1059,14 +1061,13 @@ stdenv.mkDerivation { libxml2 libxslt libzip - stdenv zlib ]; shellHook = '' # set SOURCE_DATE_EPOCH so that we can use python wheels SOURCE_DATE_EPOCH=$(date +%s) - virtualenv --no-setuptools venv + virtualenv --python=${pythonPackages.python.interpreter} --no-setuptools venv export PATH=$PWD/venv/bin:$PATH pip install -r requirements.txt ''; |