Hide Mac OS X development tools from virtualenv environment
I'm working on a set of Python scripts for a client and am looking to recreate their environment locally.
We're both running OS X Snow Leopard. I have Python 开发者_高级运维2.7.1 installed, they have the default 2.6.1. I have the developer tools installed, they don't. To make deployment as simple possible, I'm coding for 2.6.1 and looking to use libraries which don't require the dev tools.
I'm using virtualenv to create a Python 2.6.1 environment like so:
virtualenv --no-site-packages -p/usr/bin/python2.6 deployment_env/
However, this environment can still see gcc and the dev tools. How can I hide them, and so recreate the client's setup?
Have you tried modifying the PATH, LD_LIBRARY_PATH etc. environmental variables?
- PATH - is a list of paths where OS searches for default executables. So, if you need specific version of gcc,python etc. just put the directory that contains that executable at the beginning of the list, e.g. export PATH=/Users/username/mybin:$PATH
- LD_LIBRARY_PATH - is a list of where OS searches for default libraries. The logic is the same
But, in your case, chroot might be the best way to solve the problem. See: https://serverfault.com/questions/267227/why-is-chroot-never-used-on-mac-os-x and http://developer.apple.com/library/mac/#documentation/Darwin/Reference/ManPages/man2/chroot.2.html
精彩评论