[arch-general] An archlinux-python package for managing system default python version?

Chi Hsuan Yen yan12125 at gmail.com
Sat Jan 24 09:09:23 UTC 2015


Finally it turns out to be a makefile issue. If make 4.1 is used, the first
`python` found in $PATH is not used so all $PATH tricks including
virtualenv does not work. I use GNU make 3.81 instead and everything works.
Thanks for all suggestions above!

On 24 January 2015 at 11:27, 杨令 <yangling1984 at gmail.com> wrote:

> > From: Chi Hsuan Yen <yan12125 at gmail.com>
> > To: General Discussion about Arch Linux <arch-general at archlinux.org>
> > Cc:
> > Date: Fri, 23 Jan 2015 21:51:00 +0800
> > Subject: [arch-general] An archlinux-python package for managing system
> default python version?
> > Dear Arch enthusiasts,
> >
> > The package extra/java-runtime-common provides a convenient script
> > archlinux-java to handle co-existing JDK/JRE versions. I can use it to
> > switch between different versions of java implementations to accomplish
> > numerous tasks from testing the compatibilities of my programs to running
> > third party applications targeting on different platforms. Now I hope
> > there's also a simple script for the same thing but for python. On the
> > system, most of the scripts are written for python2 and some other
> scripts
> > are python3-specific. In most cases it's not a problem because I can fix
> > the scripts or use some tricks like $PATH to ensure the correct execution
> > of the programs. However, in large projects, doing either is
> time-consuming
> > and costly. Recently I'm building CyanogenMod on Arch Linux. It includes
> > lots of python scripts in the build system, and most of them requires
> > python2. Using the tip provided on the article about Python on ArchWiki
> > prevents lots of problems, but, however, some scripts have the shebang
> line
> > "#!/usr/bin/env python" or are invoked by some command like
> > "/usr/bin/python ...". I have to change the link /usr/bin/python to
> > pointing to python2 for further progress on building and changed it back
> > for my daily use. If there's an archlinux-python script, lots of time on
> > battling the difference between python2 and python3 does not exist
> anymore,
> > which I believe lots of users can benefit from it. Any ideas?
>
> sudo pacman -S python-virtualenv python2-virtualenv
> python-virtualenvwrapper
>
> Google how to use them.
>
> Actually virtualenv itself is enough. virtualenvwrapper is a useful
> wrapper, so I recommend to use them together.
>
> Here is my virtualenv and virtualenvwrapper configuration in .zshrc. You
> can take a look:
>
> # Python virtualenvwrapper
> export WORKON_HOME=$HOME/.virtualenvs
> #export VIRTUALENVWRAPPER_PYTHON=/usr/bin/python2
>
> if [ -f /usr/bin/virtualenvwrapper.sh ]; then
> source /usr/bin/virtualenvwrapper.sh
> fi
>
> # Python pip -> virtualenv only
> export PIP_REQUIRE_VIRTUALENV=true
> export PIP_RESPECT_VIRTUALENV=true
>
> ====================
> YANG Ling
> yangling1984 at gmail.com
>


More information about the arch-general mailing list