virtualenv is a tool to build sandbox(ed) or isolated Python environments. Using it you can create multiple isolated Python development environments each with their own isolated 'site-packages', which basically means giving yourself a playground which you might as well need during all the hacking. The page here http://pypi.python.org/pypi/virtualenv has a lot of details on how you can go about installing it and then creating your own sand boxes.
Here is what you would do on a Ubuntu box, if you have setuptools installed:
Installation:
$sudo easy_install virtualenvCreating a isolated Python environment:
Searching for virtualenv
Reading http://pypi.python.org/simple/virtualenv/
Best match: virtualenv 1.3.2
Downloading http://pypi.python.org/packages/2.5/v/virtualenv/virtualenv-1.3.2-py2.5.egg#md5=f2cd2b10b8be8b57e74cb1830fc0b504
Processing virtualenv-1.3.2-py2.5.egg
creating /home/amit/virtualenv-local/lib/python2.5/site-packages/virtualenv-1.3.2-py2.5.egg
Extracting virtualenv-1.3.2-py2.5.egg to /home/amit/virtualenv-local/lib/python2.5/site-packages
Adding virtualenv 1.3.2 to easy-install.pth file
Installing virtualenv script to /home/amit/virtualenv-local/bin
Installed /home/amit/virtualenv-local/lib/python2.5/site-packages/virtualenv-1.3.2-py2.5.egg
Processing dependencies for virtualenv
Finished processing dependencies for virtualenv
The above command creates a new Python virtualenv with the name 'virtual-env-1' under your
$ virtualenv --no-site-packages virtual-env-1
virtualenv --no-site-packages virtual-env-1
New python executable in virtual-env-1/bin/python
Installing setuptools............done.
pwd. Couple of things to note:- --no-site-packages: This option makes sure that when you are using the Python interpreter, it will *not* look into the global site-packages for third party packages (See this discussion for more on this topic)
- setuptools is installed automatically, so that you can start doing a easy_install (and more) in your Python environment just created
.The directory tree is pretty straight forward and spend some time looking at it. Now you can do two things:
|-- bin
| |-- activate
| |-- activate_this.py
| |-- easy_install
| |-- easy_install-2.5
| `-- python
|-- include
| `-- python2.5 -> /usr/include/python2.5
`-- lib
`-- python2.5
|-- UserDict.py -> /usr/lib/python2.5/UserDict.py
|-- UserDict.pyc -> /usr/lib/python2.5/UserDict.pyc
|-- codecs.py -> /usr/lib/python2.5/codecs.py
|-- codecs.pyc -> /usr/lib/python2.5/codecs.pyc
|-- config -> /usr/lib/python2.5/config
|-- copy_reg.py -> /usr/lib/python2.5/copy_reg.py
|-- copy_reg.pyc -> /usr/lib/python2.5/copy_reg.pyc
|-- distutils
| |-- __init__.py
| |-- __init__.pyc
| `-- distutils.cfg
|-- encodings -> /usr/lib/python2.5/encodings
|-- fnmatch.py -> /usr/lib/python2.5/fnmatch.py
|-- fnmatch.pyc -> /usr/lib/python2.5/fnmatch.pyc
|-- lib-dynload -> /usr/lib/python2.5/lib-dynload
|-- locale.py -> /usr/lib/python2.5/locale.py
|-- locale.pyc -> /usr/lib/python2.5/locale.pyc
|-- no-global-site-packages.txt
|-- ntpath.py -> /usr/lib/python2.5/ntpath.py
|-- ntpath.pyc -> /usr/lib/python2.5/ntpath.pyc
|-- orig-prefix.txt
|-- os.py -> /usr/lib/python2.5/os.py
|-- os.pyc -> /usr/lib/python2.5/os.pyc
|-- posixpath.py -> /usr/lib/python2.5/posixpath.py
|-- posixpath.pyc -> /usr/lib/python2.5/posixpath.pyc
|-- re.py -> /usr/lib/python2.5/re.py
|-- re.pyc -> /usr/lib/python2.5/re.pyc
|-- site-packages
| |-- easy-install.pth
| |-- setuptools-0.6c9-py2.5.egg
| `-- setuptools.pth
|-- site.py
|-- site.pyc
|-- sre.py -> /usr/lib/python2.5/sre.py
|-- sre.pyc -> /usr/lib/python2.5/sre.pyc
|-- sre_compile.py -> /usr/lib/python2.5/sre_compile.py
|-- sre_compile.pyc -> /usr/lib/python2.5/sre_compile.pyc
|-- sre_constants.py -> /usr/lib/python2.5/sre_constants.py
|-- sre_constants.pyc -> /usr/lib/python2.5/sre_constants.pyc
|-- sre_parse.py -> /usr/lib/python2.5/sre_parse.py
|-- sre_parse.pyc -> /usr/lib/python2.5/sre_parse.pyc
|-- stat.py -> /usr/lib/python2.5/stat.py
|-- stat.pyc -> /usr/lib/python2.5/stat.pyc
|-- types.py -> /usr/lib/python2.5/types.py
`-- types.pyc -> /usr/lib/python2.5/types.pyc
10 directories, 45 files
- Make this the default Python interpreter, using 'activate_this.py'
- or, simply refer to it using the full pathname, such as : ~/virtual-env-1/bin/python
Using 'virtualenv' on NetBeans IDE for Python:
Coming to the main focus of this post, you can use your newly created virtualenv with the NetBeans IDE for Python. Just add a new platform using Tools > Python Platforms > New:

Once added, you can verify the Python Path:

Now, you can either make it the default platform or make your use of this platform for your selected experimental projects!
Your Python test bed is ready!




3 comments:
Weekends to peopleig2tmean that they can have a two-day wowgold4europe good rest. For example, people gameusdcan go out to enjoy themselves or get meinwowgoldtogether with relatives and friends to talk with each storeingameother or watch interesting video tapes with the speebiewhole family.
Everyone spends agamegoldweekends in his ownmmoflyway. Within two days,some people can relax themselves by listening to music, reading novels,or watchingogeworld films. Others perhaps are more active by playing basketball,wimming ormmorpgvipdancing. Different people have different gamesavorrelaxations.
I often spend weekends withoggsalemy family or my friends. Sometimes my parents take me on a visit to their old friends. Sometimesgamersell I go to the library to study or borrow some books tommovirtexgain much knowledge. I also go to see various exhibition to broadenrpg tradermy vision. An excursion to seashore or mountain resorts is my favorite way of spending weekends. Weekends are always enjoyable for me.
Hello
Do you plan on update PyQt tutorial on Nebeans
http://wiki.netbeans.org/PyQT
I am really waiting for it
Interesting post. I have been wondering about this issue,so thanks for posting. I’ll likely be coming back to your blog. Keep up great writing. Find your great Travel News and sing the songs at Free Song Lyric or you can watch the drama at Korea Drama Online one of great korea drama is A Love to Kill if you go to travel to Indonesia learn Learn Indonesia Language first! And find your home cari rumah or make a blog Belajar membuat Blog find your home again rumah dijual and again at jual rumah the point is cari rumah, jual rumah, rumah dijual, download youtube and find blog widget and then if you want buy a new laptop see the Laptop Price List or you can buy a New Blackberry and then take care your Health & Jewerly good job, very great article Cari Rumah, Jual Rumah, Rumah dijual Thanks ever so much Cari Rumah, Jual Rumah, Rumah dijual very useful article Cari Rumah, Jual Rumah, Rumah dijual Great information Cari Rumah, Jual Rumah, Rumah dijual I like your blog Cari Rumah, Jual Rumah, Rumah dijual I will be checking back for any new articles Cari Rumah, Jual Rumah, Rumah dijual just bookmarked it for later reference Cari Rumah, Jual Rumah, Rumah dijual. Thanks for kindly sharing it with us. Very well done indeed
Post a Comment