This post originated from an RSS feed registered with Python Buzz
by Rand Anderson.
Original Post: Moving Python: The Problem
Feed Title: Python Postings
Feed URL: http://www.executableabstractions.com/weblog/Python/rss.xml
Feed Description: On my explorations of python
When I first installed Python, I made a mistake. I didn't think it was a mistake at the time, but have come to believe so over time.
The mistake that I am referring to is that I didn't install python to hang directly off of my root directory, as c:\python23, but rather off of another folder. [Note: This is on a Windows host]
So instead of having c:\python23, I have c:\dev\python23. This made sense to me at the time, grouping all of my development tools/libs/sdks under a single c:\dev folder, and it still makes sense to me conceptually. But over time, I have realized two things, at least wrt python: 1) Certain kinds of installs prompt you for the target location (rather than just finding where python is already installed), and these usually default to c:\python23; and 2) I have occasionally found that some installs (could be python packages, or maybe other tools that embed python facilities) create a c:\python23 folder and put some stuff in it. I haven't always noticed cases of the latter immediately, so I'm not sure who the culprits are.
Right now for instance, I see that c:\python23 was created recently, and it contains 3 files (and no subfolders): MSVCIRT.dll, MSVCP60.dll, and MSVCRT.dll. I recognize these as the runtime files for apps built with Visual Studio 6. But who put them there? And what is the impact, if any, of this rogue python folder?
Worse, something also messed with some of my registry settings for python-related paths. I searched the registry for occurrences of '\python23' and found some to be 'c:\dev\python23' and others to be 'c:\python23'. Ayy. Even more confusing was when I realized that I might have been the cause of some of these, due to factor#1 above: when installs prompt for the target python folder, and default to c:\python23, I wouldn't be surprised if I sometimes glazed over at that step and just (incorrectly) went with the default.
In any case, I think that these ongoing problems can all be cleared up if I move my python folder from c:\dev\python23 to c:\python23. The question is how?
I've searched around the likely places, but haven't found a recipe for doing this. So...
Option 1: Re-install python from scratch
This, I am sure, is the cleanest approach. The only reason I am looking for another option is that I am not as confident about easily getting back to my current 'state' of python installation, meaning having all of the same releases of python packages, and tweaks or customizations of python scripts, etc.
I am pretty sure that all such customizations on top of the base python23 install are isolated to four categories/places:
Lib\site-packages
Scripts, where I've customized some of the scripts that get installed and added my own
The files from Python.NET which enable access to .NET assemblies
myScraps, my own folder for keeping bits and pieces of useful code
This might lead to Option 1a, reinstall python and then handle these exceptions manually, but I'm uncomfortable with this approach, with assuming that there are no other post-base-python-install areas to account for. Plus, if I have to hand-manage all these individually...which leads me to option 2.
Option 2: Physically move the python folder, and make necessary adjustments manually
I think that with this approach, the manual adjustments are limited to:
Search and edit all registry entries that mention \python23
Edit the paths of existing batch files in the Scripts folder (I did a grep for hardcoded refs to '\python23' in the whole python tree and the only results were in scripts and in some install log files)
Change my path to point to the new python root location
If anyone has any comments, or an easier option, please let me know; otherwise, I'll report back in a few days with 'Moving Python: A Solution'.