I have a Windows 7 machine with a 32-bit install of anaconda, installed for the local user. The install works as expected: it allows me to run python and pip from the command line, switch environments, etc.
I also have a library of code that I wrote sitting in My Documents. I would like to add an entry like C:\Users\username\Documents\MyLib
to my PYTHONPATH
. This would normally not be an issue, but I do not have the elevated privileges that this (work-issued) computer requires to modify environment variables through the Windows UI.
I am looking for a way to set PYTHONPATH. I only need it to work within the anaconda environment (i.e., I just want to be able to import my library using that particular interpreter). Solutions using sys.path.append
within my scripts are not acceptable. I am, however, OK with doing sys.path.append
in some script that will be executed automatically whenever I run python myscript.py
.
I suspect that there is a way to get around the privilege restrictions imposed through the Windows UI though, because running conda info -a
shows that the Anaconda installer was able to insert items into the PATH
, specifically, C:\Users\username\AppData\Local\Continuum\Anaconda3\Library\bin;...
.
Since you said, you mostly use Spyder, the following might be useful:
Spyder offers the option to manage PYTHONPATH through an integrated manager.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With