jenkinsci / pyenv-pipeline-plugin

Execute commands in Python virtualenvs in Jenkins Pipeline DSL
https://plugins.jenkins.io/pyenv-pipeline/
MIT License
33 stars 15 forks source link

Virtualenv with a specific Python version #7

Closed LJBD closed 6 years ago

LJBD commented 6 years ago

I've got Python 2.7 and 3.5 installed on my Jenkins node and I need to create a virtualenv with a specific Python interpreter version - 3.5, which is not my system default. Something like:

withPythonEnv("my_python_3_env") {
    pysh "pip3 install some_python_3_package"
}

Can I do this with your plugin?

LJBD commented 6 years ago

Allright, I've got it. If I use withPythonEnv("python3"), it creates precisesly what I need - a build-specific virtualenv with Python 3.5. The gimmick is to use pip instead of pip3 inside it (because the latter is resolved to system pip3).