Make sure that
If using Anaconda Prompt it is automatically activated.
Here a quick run where i use cmder,so i activate myself has to same if just use cmd/poweshell.
(base)
environment is active this is required in later version of Anaconda.If using Anaconda Prompt it is automatically activated.
Here a quick run where i use cmder,so i activate myself has to same if just use cmd/poweshell.
G:\Anaconda3 λ cd Scripts\ # Activate, see that now show (base) G:\Anaconda3\Scripts λ activate # Test pip,it will now always use pip form Anaconda # If i deactivate it will use my Python 3.9 pip (base) G:\Anaconda3 λ pip -V pip 20.0.2 from G:\Anaconda3\lib\site-packages\pip (python 3.7) # Install (base) G:\Anaconda3 λ pip3 install pysolar Collecting pysolar Downloading pysolar-0.9-py3-none-any.whl (46 kB) |████████████████████████████████| 46 kB 866 kB/s Installing collected packages: pysolar Successfully installed pysolar-0.9 # Test that it work (base) G:\Anaconda3 λ python Python 3.7.3 (default, Mar 27 2019, 17:13:21) [MSC v.1915 64 bit (AMD64)] :: Anaconda, Inc. on win32 Type "help", "copyright", "credits" or "license" for more information. >>> from pysolar.solar import * >>> import datetime >>> >>> latitude = 42.206 >>> longitude = -71.382 >>> >>> date = datetime.datetime(2007, 2, 18, 15, 13, 1, 130320, tzinfo=datetime.timezone.utc) >>> print(get_altitude(latitude, longitude, date)) 30.914468243599078So if using it from a Editor eg VS Code that i use will use
code .
to start from command line so it find environment automatically or can manually choice it in Editor.