Skip to content

python how to find installed astropy: 2.7. Execute .py with “python2.7

The following red material is the newest guidance:
Note that since astropy is in 2.7, 2.7 should really be the default, not 2.6 as it now is. 
To run 2.7 on a program sitting in a file called “nameOfThisFile”,  Type:
“python2.7 nameOfThisFile” in command line, as Helen did in comments atop her IonRMdailyPlot.py  , which is in
/data/psrdata/usr5/rmiono/ionFR-Sobey/

Helen Du figured out the following for finding where (if) astropy is on our network:

/usr/local/lib/python2.7/site-packages (Joel changes this to 2.6 but that doesnt work. see helen’s and Joel’s update at bottom. Esp very top in red)
is where all the packages are.
Specifically, “David Hollander” pointed me to the right path. Here’s what he said:

For Ubuntu,

python -c "from distutils.sysconfig import get_python_lib; print get_python_lib()"

…is not correct.

It will point you to /usr/lib/pythonX.X/dist-packages

This folder only contains packages your operating system has automatically installed for programs to run.

On ubuntu, the site-packages folder that contains packages installed via setup_tools\easy_install\pip will be in /usr/local/lib/pythonX.X/dist-packages

The second folder is probably the more useful one if the use case is related to installation or reading source code.

If you do not use Ubuntu, you are probably safe copy-pasting the first code box into the terminal.

—————————————————————————–
additional information added by Helen shortly after the above:
Another note:
/usr/lib/python2.6/site-packages  seems to be where the packages that have the basic/initial/…(can’t think of the correct word…) packages for running Python 2.6,
while
/usr/lib64/python2.6/site-packages  has other stuff as well… including scipy, numpy, and matplotlib.

Published inInstalled softwarePython

Be First to Comment

Leave a Reply

Your email address will not be published. Required fields are marked *