Skip to content Skip to sidebar Skip to footer

Python Only Works With Sudo

My python 2.7 script works on my Ubuntu system if I call it using sudo python [filename].py or from a bash script using sudo ./[bashscriptname].sh But if I call it from Pycharm

Solution 1:

My band-aid solution was to notice that when I tried a sudo pip install pandas, I got a notice: Requirement already satisfied: pandas in /usr/lib/python2.7/dist-packages

I stuck a sys.path.insert(1, '/usr/lib/python2.7/dist-packages') near the top of my script and it's now working okay.

Thanks tremendously to @Joe!!

My next steps are a complete do-over of my python install, hopefully without the sudos... (thank you @xgord)

Post a Comment for "Python Only Works With Sudo"