so I am a new Python user, just learning the ropes. I installed Python as a requirement for a course I am taking. My problem first arose when I used pip to install the 'bottle' package, which installed fine, however, when I try to access my .py file that uses bottle with the following command python C:\Python27\hello_bottle.py
, I get an
ImportError: no module named bottle.
The frustrating part is that I could get bottle to work in other ways, the most prevalent one being: running Python, import sys, then appending sys.path to include the appropriate directory for my machine, which is C:\Python27\Lib\site-packages
When I did that, I was able to import and use bottle temporarily, however, it only worked for the current instance of Python, and I wanted a permanent solution. So, in my search for such a solution, I came accross the concept of setting up the environment variables PYTHONHOME and PYTHONPATH, which I promptly went about doing. Presently, they are set up as follows:
Path = C:\Program Files\MongoDB\Server\3.4\bin;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Skype\Phone\;C:\Program Files (x86)\QuickTime\QTSystem\;C:\Python27;C:\Python27\Scripts;C:\Python27\Lib\site-packages;%PYTHONHOME%;%PYTHONPATH;
PYTHONHOME = C:\Python27
PYTHONPATH = C:\Python27\Lib;%PYTHONHOME%
Now, on account of this working when I ran the code in python earlier, setting up the sys.path variable, I thought I had my solution and that this would work. But, on the contrary, things got worse. Now, when I try to run Python from my cmd prompt (I use Babun), I get a new error: "ImportError: no module names site"
This is even more concerning, because after some research I found that this is what sets up the paths for Python, and now the entire program is not working. What's even more troubling, is that one time it just randomly worked without me changing anything, and then the next time I opened cmd it was back to not working again.
When I set the path variables the first time, I used the "export" command, then I reset them with the "setx" command, and finally I went into my system settings and just created the environment variables there (which is where I am at now).
Any help with this would be greatly appreciated, I'm pulling my hair out with frustration. Thank you!
Cheers, Jesse