Reputation: 391
Running Enthought Canopy appears to de-activate the normal .profile PATH information (OS X) for python programs run within the Canopy environment. I need to make locations searchable for user files.
How to do this is not explained in the user manual. There are several possible places to enter such information (eg the two 'activate' files) but adding extra PATH information in them has no effect.
So how is it done?
DN
Upvotes: 3
Views: 6899
Reputation: 391
This follows from the link to Setting environment variables in OS X? on the page posted by Jonathan. I had made a mistake with the command syntax in the file '/private/etc/launchd.conf'.
Creating or editing the file 'launchd.conf' (using an editor that is aware of permissions, eg BBEdit) in /private/etc with something like the following line:
setenv PYTHONPATH /Users/<username>/Python/:/Users/<username>/AnotherPath/
,
for example, will create a variable PYTHONPATH that, after rebooting, Canopy sees.
It works for other environment variables, too. The launchd.conf file is all that's needed, and, what's even better, it appears to stick between boots.
Upvotes: 1
Reputation: 11
On Mac OSX 10.6.8 this worked
% launchctl setenv PYTHONPATH /my/directory:/my/other/directory
then launch Canopy and you should see /my/directory and /my/other/directory on sys.path
Upvotes: 1
Reputation: 5810
Does the following article answer this question adequately?: https://support.enthought.com/entries/23665767-How-do-I-set-PYTHONPATH-and-other-environment-variables-for-Canopy-
Upvotes: 0
Reputation: 1
The problem described also occurs in a Win 7 Canopy installation.
I tried to place files to be imported in several of the locations provided in sys.path().
['', 'C:\Users\Owner\AppData\Local\Enthought\Canopy\User\Scripts\python27.zip', 'C:\Users\Owner\AppData\Local\Enthought\Canopy\App\appdata\canopy-1.0.0.1160.win-x86_64\DLLs', 'C:\Users\Owner\AppData\Local\Enthought\Canopy\App\appdata\canopy-1.0.0.1160.win-x86_64\lib', 'C:\Users\Owner\AppData\Local\Enthought\Canopy\App\appdata\canopy-1.0.0.1160.win-x86_64\lib\plat-win', 'C:\Users\Owner\AppData\Local\Enthought\Canopy\App\appdata\canopy-1.0.0.1160.win-x86_64\lib\lib-tk', 'C:\Users\Owner\AppData\Local\Enthought\Canopy\App\appdata\canopy-1.0.0.1160.win-x86_64', 'C:\Users\Owner\AppData\Local\Enthought\Canopy\User', 'C:\Users\Owner\AppData\Local\Enthought\Canopy\User\lib\site-packages', 'C:\Users\Owner\AppData\Local\Enthought\Canopy\System', 'C:\Users\Owner\AppData\Local\Enthought\Canopy\System\lib\site-packages', 'C:\Users\Owner\AppData\Local\Enthought\Canopy\System\lib\site-packages\PIL', 'C:\Users\Owner\AppData\Local\Enthought\Canopy\System\lib\site-packages\win32', 'C:\Users\Owner\AppData\Local\Enthought\Canopy\System\lib\site-packages\win32\lib', 'C:\Users\Owner\AppData\Local\Enthought\Canopy\System\lib\site-packages\Pythonwin', 'C:\Users\Owner\AppData\Local\Enthought\Canopy\App\appdata', 'C:\Users\Owner\AppData\Local\Enthought\Canopy\App\appdata\canopy-1.0.0.1160.win-x86_64\lib\site-packages', 'C:\Users\Owner\AppData\Local\Enthought\Canopy\App\appdata\canopy-1.0.0.1160.win-x86_64\lib\site-packages\IPython\extensions']
The only solution I found was to use:
sys.path.append()
Upvotes: 0