python: how do you setup your workspace on Ubuntu?
Lets say I have my workspace (on Eclipse) where I develop my Python modules and I would like to "link开发者_如何学Go" my working files to system Python paths. I know I can drop .pth files etc. but I would like to get the community's wisdom as to the best practices.
One thing you can try is creating a virtual environment and then pointing pydev at the interpreter inside the virtual environment.
$ virtualenv --no-site-packages myProject
$ cd myProject
$ source bin/activate
(myproject)$
at that point you have a python interpreter that will reference libraries in ~/myProject/lib/python2.x/site-packages
So in pydev in your workspace select ~/myProject/bin/python as your python interpreter. In this way you aren't infecting your system install of python, won't need root permissions to install stuff etc....
Speaking of which, virtualenv sets up an "easy_install" bin so you can install whatever libs you need, again without infecting your system python install.
(myproject)$easy_install sqlalchemy paste pylons ipython sphinx
#...download to win...
And if you do install paste, you can create package templates rather than doing it by hand like so...
(myproject)$ paster create mynewlib
#...do stuff to win...
(myproject)$ cd mynewlib
(myproject)$ python setup.py develop
#...puts links in your virtualenv site-packages but does not move the source
(myproject)$ <start hacking>
Check out this screencast series on ShowMeDo, it helped me A LOT
Hope that helps.
精彩评论