Forgiven Posted May 20, 2014 Share Posted May 20, 2014 Hi folks. I have some funky stuff going on. I recently loaded some new modules, but they appear in a new and different path than my other modules. To be clear I have a working set of python modules for scientific computing in /Users/myname/Library/Python/2.7/site-packages. The new modules I loaded using pip install sent them to /usr/local/lib/python2.7/site-packages. I want all of them in /Users/myname/Library/Python/2.7/site-packages. How can I move all the site-packages from the /usr...path to the /Users...path using the kind of command-line kung fu some of you know? AND make sure any future installs all go to my desired /Users...site-packages path? OR: what is the cleanest way to uninstall all the stuff (delete) in /usr...site-packages path and force all the reinstall to the /Users..site-packages path? I didn't find the answers I need on StackOverflow. If you can help with script kiddie line-by-lines that would really lower my blood pressure. I'm a chemist not a coder :) Thanks in advance. Quote Link to comment Share on other sites More sharing options...
Elk Posted May 21, 2014 Share Posted May 21, 2014 (edited) Python on a Mac... I've had my share of headaches with that. You can just move/copy the pip installed modules to the other directory (Check the directories first in case some stuff might get overwritten). cp -r /usr/local/lib/python2.7/site-packages/* /Users/myname/Library/Python/2.7/site-packages or use rsync rsync -azrv /usr/local/lib/python2.7/site-packages /Users/myname/Library/Python/2.7/ The advantage of rsync are that you won't overwrite exisiting files that are identical as they won't be copied. If the files differ however then they will be overwritten, so make sure there's no special version of a module in the user directory first. The flags mean: a - archive mode r - recursive v - verbose z - compress during transfer (may not need that) or just use `pip remove <package>` to delete them and re-install later. To change the install path of the packages for pip use the -t, --target <dir> flag when you run the install Unfortunately there doesn't seem to be a global config file for pip, so you'll have to add that flag each time. Edited May 21, 2014 by Elk Quote Link to comment Share on other sites More sharing options...
Forgiven Posted May 22, 2014 Author Share Posted May 22, 2014 The only thing I had to modify with the rsync method was type in sudo before your script. THANKS A TON. It worked great. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.