Skip to content

Tag: shell

How to install Python packages in a specific environment?

I installed Anaconda3 so I can create environments and install different packages in each environment. But I fail to understand the difference between the Python in and I can seem to access Python 3.6.5 Anaconda from both, why is that? And, what is the difference between both? Furthermore, I would like to ins…

Set shell environment variable via python script

I have some instrument which requires environment variable which I want to set automatically from python code. So I tried several ways to make it happen, but none of them were successful. Here are some examples: I insert following code in my python script I created bash script(env.sh) and run it from python: …

Change working directory in shell with a python script

I want to implement a userland command that will take one of its arguments (path) and change the directory to that dir. After the program completion I would like the shell to be in that directory. So I want to implement cd command, but with external program. Can it be done in a python script or I have to writ…

os.system() execute command under which linux shell?

I am using /bin/tcsh as my default shell. However, the tcsh style command os.system(‘setenv VAR val’) doesn’t work for me. But os.system(‘export VAR=val’) works. So my question is how can I know the os.system() run command under which shell? Answer os.system() just calls the syst…