How to code an installation according to the python version?
I would like to install with pip a particular version of a library depending on the version of python.
Something like this:
if ["$python_version" == "3.5"]; then pip3 install Foofoo==1.1.1; fi
the current appveyor.yml file:
environment:
matrix:
- PYTHON: "C:\Python35"
- PYTHON: "C:\Python36"
- PYTHON: "C:\Python37"
build: off
install:
- ps: iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-desktop.ps1'))
- "SET PATH=%PYTHON%;%PYTHON%\Scripts;%PATH%"
- "python -m pip install --upgrade pip"
- "pip install --upgrade -vv setuptools"
- "pip install --upgrade cython"
- "pip install numpy"
- "pip install freetype-py"
- "pip install pypng"
- "pip install --upgrade pywavelets"
- "pip install pypiwin32"
- "python setup.py install"
- "git lfs install"
- "git lfs pull"
- "echo y | pip uninstall PyQt5"
- "pip install PyQt5==5.9.2"
- "git clone --depth=50 --branch=master https://github.com/populse/populse_db.git C:\projects\populse-db"
- "cd C:\projects\populse-db"
- "pip install -e .[postgres]"
#- "pip install --force-reinstall lark-parser==0.6.7"
- "cd .."
- "git clone --depth=50 --branch=master https://github.com/populse/soma-base.git C:\projects\soma-base"
- "cd populse-mia"
- "SET PYTHONPATH=C:\projects\populse-mia\python\;%PYTHONPATH%"
- "SET PYTHONPATH=C:\projects\soma-base\python\;%PYTHONPATH%"
test_script:
- "python --version"
- "python .\python\populse_mia\test.py -v"
notifications:
- provider: Email
to:
- '{{commitAuthorEmail}}'
on_build_failure: true
on_build_success: false
on_build_status_changed: true
the appveyor.yml file (but with the right syntax that I can't find!) that I would like to use:
environment:
matrix:
- PYTHON: "C:\Python35"
- PYTHON: "C:\Python36"
- PYTHON: "C:\Python37"
build: off
install:
- ps: iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-desktop.ps1'))
- "SET PATH=%PYTHON%;%PYTHON%\Scripts;%PATH%"
- "python -m pip install --upgrade pip"
- "pip install --upgrade -vv setuptools"
- "pip install --upgrade cython"
- "pip install numpy"
- "pip install freetype-py"
- "pip install pypng"
- "pip install --upgrade pywavelets"
- "pip install pypiwin32"
if ["$python_version" == "3.5"]; then pip3 install Foofoo==1.1.1; fi # but with the good syntax
- "python setup.py install"
- "git lfs install"
- "git lfs pull"
- "echo y | pip uninstall PyQt5"
- "pip install PyQt5==5.9.2"
- "git clone --depth=50 --branch=master https://github.com/populse/populse_db.git C:\projects\populse-db"
- "cd C:\projects\populse-db"
- "pip install -e .[postgres]"
#- "pip install --force-reinstall lark-parser==0.6.7"
- "cd .."
- "git clone --depth=50 --branch=master https://github.com/populse/soma-base.git C:\projects\soma-base"
- "cd populse-mia"
- "SET PYTHONPATH=C:\projects\populse-mia\python\;%PYTHONPATH%"
- "SET PYTHONPATH=C:\projects\soma-base\python\;%PYTHONPATH%"
test_script:
- "python --version"
- "python .\python\populse_mia\test.py -v"
notifications:
- provider: Email
to:
- '{{commitAuthorEmail}}'
on_build_failure: true
on_build_success: false
on_build_status_changed: true
Comments are currently closed for this discussion. You can start a new one.
Keyboard shortcuts
Generic
? | Show this help |
---|---|
ESC | Blurs the current field |
Comment Form
r | Focus the comment reply box |
---|---|
^ + ↩ | Submit the comment |
You can use Command ⌘
instead of Control ^
on Mac
Support Staff 1 Posted by Feodor Fitsner on 16 Apr, 2020 10:41 PM
So, on Windows you can have something like:
Support Staff 2 Posted by Feodor Fitsner on 16 Apr, 2020 10:44 PM
...or, alternatively have different
install
sections for every Python:3 Posted by servoz on 16 Apr, 2020 11:19 PM
Thank you very much!
As always you give a precise and very high quality answer !
You solved my problem perfectly!
Thank's again !
All the best
servoz closed this discussion on 16 Apr, 2020 11:19 PM.