Tools for using virtual environments and PEP 370

Дамјан Георгиевски gdamjan at gmail.com
Fri Nov 28 16:45:27 EST 2008


> Python 2.6 implemented PEP 370: Per-user site-packages Directory

Ok, you can completelly replace virtualenv with 
a) setting PYTHONUSERBASE=<something>
b) Editing ~/.pydistutils.cfg  to be like:
	[install]
	user=True

After this, installing new packages go to $PYTHONUSERBASE/lib/python2.6/site-packages/.

I've also tried pip.py and it mostly works fine with this setup except for one bug where
it tries to write a install-record-%s.txt file in /usr/lib/.../ 

I've hacked it with this crude patch (which is not correct always).

@@ -1388,7 +1389,8 @@
         if sys.platform == 'win32':
             install_location = os.path.join(sys.prefix, 'Lib')
         else:
-            install_location = os.path.join(sys.prefix, 'lib', 'python%s' % sys.version[:3])
+            import site
+            install_location = os.path.join(site.USER_BASE, 'lib', 'python%s' % sys.version[:3])
         record_filename = os.path.join(install_location, 'install-record-%s.txt' % self.name)
         ## FIXME: I'm not sure if this is a reasonable location; probably not


-- 
дамјан ( http://softver.org.mk/damjan/ )

A: Because it reverses the logical flow of converstion.
Q: Why is top posting frowned upon?



More information about the Python-list mailing list