python-binance
python-binance copied to clipboard
ModuleNotFoundError: No module named 'binance'
Trying to access the binance API.
from binance.client import client client = client(api_key, api_secret)
But I get this error :
D:\Users\username\Desktop\pyproject>get_data.py
Traceback (most recent call last):
File "D:\Users\username\Desktop\pyproject\get_data.py", line 1, in
Everything was installed as expected. Using pip install python-binance command
There is a binance directory in ...\site-packages\
System paths for python using import sys sys.path are :
['',
'D:\Users\username\AppData\Local\Programs\Python\Python38\python38.zip',
'D:\Users\username\AppData\Local\Programs\Python\Python38\DLLs',
'D:\Users\username\AppData\Local\Programs\Python\Python38\lib',
'D:\Users\username\AppData\Local\Programs\Python\Python38',
'D:\Users\username\AppData\Local\Programs\Python\Python38\lib\site-packages',
'D:\Users\username\AppData\Local\Programs\Python\Python38\lib\site-packages\win32',
'D:\Users\username\AppData\Local\Programs\Python\Python38\lib\site-packages\win32\lib',
'D:\Users\username\AppData\Local\Programs\Python\Python38\lib\site-packages\Pythonwin']
I have tried everything.
Please help ! Thank you
a possible reason could be, that you install with pip for python2 but you run the script with python3.
just try to install with pip3 or python3 -m pip install python-binance and then run your script again and look if its solved.
I gave It a chance but no success...
I have pip 20.3.3
Thank you for helping @oliver-zehentleitner
I had the exact same issue today, hopefully this will help you too. I realised it was because I had named my file binance.py !!! Why do stupid errors take the longest to unpick.
Same problem here on Ubuntu 18.04LTS and Windows 10. When running pip install python-binance, there appears to be an error when installing Twisted:
src/twisted/test/raiser.c:4:10: fatal error: Python.h: No such file or directory
#include "Python.h"
^~~~~~~~~~
compilation terminated.
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
Everything I have found about this error says to install python3-dev and/or python-dev. It didn't help me but it may help you.
Same problem here on Ubuntu 18.04LTS and Windows 10. When running
pip install python-binance, there appears to be an error when installing Twisted:src/twisted/test/raiser.c:4:10: fatal error: Python.h: No such file or directory #include "Python.h" ^~~~~~~~~~ compilation terminated. error: command 'x86_64-linux-gnu-gcc' failed with exit status 1Everything I have found about this error says to install
python3-devand/orpython-dev. It didn't help me but it may help you.
When installing with python3.9 on Ubuntu 20.04.2 LTS I ran into the same error listed here. Steps to resolve were:
sudo apt-get update
sudo apt-get upgrade
sudo apt install python3.9-dev
pip install python-binance
All worked as intended afterwards
by calling your file binance.py, and then trying to import from binance.client python is looking in your binance.py file.
If you rename your local file then you won't have an issue.
I had that same problem. I solve it by uninstalling all libraries named "binance" and the installing the one that i need on the console of the program that I use (spyder). I mean, try in your "cmd" to do "pip uninstall binance" and also "pip uninstall python-binance", then enter in the enviroment or lenguague you are using (I recomend to use spyder from anaconda) to code and in the console of that enviroment or lenguague write "pip install python-binance". Problem solved ;). I use spyder as enviroment or lenguage.