Module organization and IPython

Reilly has a bit of a hack for you to get around the fact that you don’t have the necessary administrative privileges on your computers to install python packages in the conventional way. Save this code

mkdir pypackages 
cd pypackages
setx PATH "%cd%"
pip install numpy -t %cd%
pip install vpython -t %cd%
pip install ipython -t %cd%
pip install uncertainties -t %cd%
pip install astropy -t %cd%
pip uninstall backports.shutil_get_terminal_size
pip install backports.shutil_get_terminal_size -t %cd%
pip install pathlib2 -t %cd%
ECHO python -c "from IPython import embed; embed()" >> ipython.bat

as a ‘.bat’ file to the root of your U:\ drive and run it. From now on, all the packages you should need to import will reside in the newly created ‘U:\pypackages’ directory (no more hauling them around between working directories!).

As an added bonus, you can now run IPython from the command line should you desire (alternatively, you can do so by running the newly created ipython.bat in the U:\pypackages directory). This means you can now work with Notepad++/IPython instead of (V)IDLE. This would be Reilly’s personal preference, though it doesn’t have to be yours.

If you continue to pursue python development (or code-writing in any language), you may wish to explore an Integrated Development Environment at some point. Reilly’s pro-tip for python is to use a Miniconda installation and the PyCharm IDE. We won’t be using these for SSP, but when you have your own computing hardware to monkey with, give it a try you’ll wonder that you were able to accomplish so much at SSP the hard way. 😉


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s