I would like to fetch some stocks data via the iexfinance API but can't get the package running.
I installed the iexfinance module ( docu )
C:\Users\Jonas\Desktop\CFD\CFD>pip3 install iexfinance
Collecting iexfinance
Using cached iexfinance-0.4.3-py3-none-any.whl (51 kB)
Installing collected packages: iexfinance
Successfully installed iexfinance-0.4.3
Started a seperate app 'feeder' for the API logic
C:\Users\Jonas\Desktop\CFD\CFD>py manage.py startapp feeder
Included it in my settings
INSTALLED_APPS = [
[...]
# My Apps
'calculator',
'accounts',
'feeder',
]
And created one first easy query:
from iexfinance.stocks import Stock
aapl = Stock("AAPL")
apple_price = aapl.get_price()
print(apple_price)
and get this error:
C:\Users\Jonas\AppData\Local\Programs\Python\Python38\python.exe C:/Users/Jonas/Desktop/CFD/CFD/feeder/feeder.py
Traceback (most recent call last):
File "C:/Users/Jonas/Desktop/CFD/CFD/feeder/feeder.py", line 8, in <module>
from iexfinance.stocks import Stock
ModuleNotFoundError: No module named 'iexfinance'
Process finished with exit code 1
My manage.py
file links to the correct settings.py path.
What do i miss?
After struggling for hours, I found the -probably obvious- solution:
Check your IDEs project interpreter, if it is set to the correct python path, be it a virtualenv or not. Make sure that the module that can't be found is in the list of the packages shown in the interpreters overview within the IDE. Somehow pip installed the packages correctly, but the interpreter searched in the wrong directory for the packages.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.