Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #74694
| From | Javier <nospam@nospam.com> |
|---|---|
| Newsgroups | comp.lang.python |
| Subject | Re: Multiple python versions, one dev environment??? |
| Date | 2014-07-17 21:52 +0000 |
| Organization | Aioe.org NNTP Server |
| Message-ID | <lq9gjp$hfs$1@speranza.aioe.org> (permalink) |
| References | <20140717173231.7cfefae5@xs4all.nl> <lq8s86$rer$3@speranza.aioe.org> <20140717215251.7e3a51aa@xs4all.nl> |
> I can work with this (have not tried though), but there must be a
> more elegant solution than symlinking my way forward...
I don't really understand what you are trying to do, but I would advise
to use environment variables to control the behaviour of the fake scripts
in /usr/local/bin
In bash you can do
export PYVERSION=2.5
And from that time onwards everything defaults to python2.5.
note the ${PYVERSION} that I have included now in the sample scripts
below to select the python version.
I don't think you need to, but if you want to change the environment
variable inside python you can set environment variables with something like
os.environ.????? Look at the docs.
Caveat1: I have not tested this, but it should work ok. The setup I use is
much simpler: just default to python2.7
Caveat2: Arch linux packagers dont use a consistent naming of things:
There exists /usr/bin/virtualenv3, but there does not exist
/usr/bin/sphinx-build3 (it is /usr/bin/sphinx-build)
Somebody should send a bug to the package maintainer.
PS: Once you setup a workaround to bypass all the python=python3 nonsense,
Arch Linux is a nice linux distro, the best out there. I will stick
to it.
HTH
========/usr/local/bin/python===========================================
#!/bin/bash
script=`readlink -f -- "$1"`
case "$script" in
/usr/bin*)
exec python3 "$@"
;;
esac
exec python${PYVERSION} "$@"
========/usr/local/bin/virtualenv===========================================
#!/bin/bash
script=`readlink -f -- "$1"`
case "$script" in
/usr/bin*)
exec virtualenv3 "$@"
;;
esac
exec virtualenv${PYVERSION} "$@"
Joep van Delft <joepvandelft@xs4all.nl> wrote:
> Hello Javier!
>
> Thanks, those links are helping a bit. And: yes, I am using Archlinux.
>
> But still those links assume that there are totally separate
> site-packages* directories installed for both. I am not sure how I
> would surpass this distinction between py-X.P and py-Y.Q.
>
> Should I really create a massive amount of symlinks like this?:
>
> | #!/usr/bin/zsh
> | for d in ~/src/mypackage/**/*(/); do
> | # matches all directories
> | mkdir -p "~/src/py-2.7/mypackage/${d#*src/mypackage}"
> | mkdir -p "~/src/py-3.4/mypackage/${d#*src/mypackage}"
> | done
> | for f in ~/src/mypackage/**/^*.pyc(.); do
> | # matches all files except for *.pyc
> | ln -s "$f" "~/src/py-2.7/mypackage${f#*src/mypackage}"
> | ln -s "$f" "~/src/py-3.4/mypackage${f#*src/mypackage}"
> | done
>
> ...and then set $PYTHONPATH according to the target version in a
> #!/usr/local/bin-script?
>
> I can work with this (have not tried though), but there must be a
> more elegant solution than symlinking my way forward...
>
> Cheers!
>
>
> Joep
>
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Multiple python versions, one dev environment??? Joep van Delft <joepvandelft@xs4all.nl> - 2014-07-17 17:32 +0200
Re: Multiple python versions, one dev environment??? Javier <nospam@nospam.com> - 2014-07-17 16:05 +0000
Re: Multiple python versions, one dev environment??? Joep van Delft <joepvandelft@xs4all.nl> - 2014-07-17 21:52 +0200
Re: Multiple python versions, one dev environment??? Javier <nospam@nospam.com> - 2014-07-17 21:52 +0000
Re: Multiple python versions, one dev environment??? Akira <4kir4.1i@gmail.com> - 2014-07-17 16:29 +0000
Re: Multiple python versions, one dev environment??? Ned Batchelder <ned@nedbatchelder.com> - 2014-07-17 15:41 -0400
Re: Multiple python versions, one dev environment??? Joep van Delft <joepvandelft@xs4all.nl> - 2014-07-17 21:54 +0200
Re: Multiple python versions, one dev environment??? Roy Smith <roy@panix.com> - 2014-07-17 19:44 -0400
Re: Multiple python versions, one dev environment??? alex23 <wuwei23@gmail.com> - 2014-07-18 11:15 +1000
Re: Multiple python versions, one dev environment??? Roy Smith <roy@panix.com> - 2014-07-17 21:29 -0400
Re: Multiple python versions, one dev environment??? Chris Angelico <rosuav@gmail.com> - 2014-07-18 12:42 +1000
csiph-web