Using Canopy as package manager for Pyhon


It's a very headache problem for package management in Python, don't like R, we could use a single command only to install a package. Although, there are some efforts have been made to facilitate package management in Python, even though there are not perfect now.

In this article, I'd like to show how to use Canopy as package manager. More info. about Canopy please consult: https://www.enthought.com/products/canopy/.

1. Intall Canopy, down load Canopy from its website: https://www.enthought.com/downloads/.

bash canopy-YourVersion.sh

2. Initialize Canopy by execute following cammand:

${PATHToCanopyInstallation}/canopy

After this initialization, there will be one directory established:  ~/Enthought/Canopy_32bit/User or ~/Enthought/Canopy_64bit/User

 3. If you just want to use Canopy's interface, you can stop here, after add this line to you .bashrc file, then every time, just run Canopy by type canopy.

source ~/Enthought/Canopy_32bit/User/bin/activate

4. But, if you want to use Canopy as a Python package manager, and want to use your own Python for some reasons, please do following. Add PATH for Canopy and also set PYTHONPATH making it pointing to Canopy's package folder. Then our native Python cloud load modules managed by Canopy.

1 # set path for canopy, then we can use canopy's utility as a package manager. eg. enpkg
2 PATH=/home/wangminxian/Enthought/Canopy_64bit/User/bin:$PATH
3 # do not activate canopy virtual environment, in order to use our own python(Important).
4 #source /home/wangminxian/Enthought/Canopy_64bit/User/bin/activate
5 # set PYTHONPATH point to canopy taking charged path, then we can manage python package by canopy.
6 export PYTHONPATH=/home/wangminxian/Enthought/Canopy_64bit/User/lib/python2.7/site-packages
7 #load my own python, because set PYTHONPATH, missing package will be load from that, therefore, using canopy as a package manager.
8 PATH=/home/wangminxian/bin/python/Python-2.7.5_build/bin:$PATH

5. install and update Python package by Canopy utility, enpkg.

1 #Enter your email and EPD password when prompted:
2 $ enpkg --userpass
3 
4 #Update whatever packages you like, to the most recent versions in the online EPD repository:
5 $ enpkg ipython
6 $ enpkg pandas
7 $ enpkg matplotlib
8 $ enpkg scipy

References:

1. https://support.enthought.com/entries/22415022-Using-enpkg-to-update-EPD-packages

2.https://www.enthought.com

posted @ 2013-08-05 01:12  wavefancy  阅读(495)  评论(0)    收藏  举报