Here is an article based on his requirements:
Ethereum: syntax error by importing the module in Ubuntu 16.04
After the first test phase, between various alternative implementation of API Binance, I decided to try the most distributed: Python-Binance.
I use Python 3.5 on Ubuntu 16.04.
Installation of the required packages
Before we can continue, it is necessary to make sure that all necessary packages are installed in our system. Here is a step by step guide:
install PIP (Python Package Manager)
First, let’s update the package index and install PIP:
`Bash
SUDO APT-GET update
Sudo apt-get installation python3-pip
install the Binance Python library
Then we will install the Python-Binance library using PIP. Run the following command:
`Bash
Python3 -M PIP Install Python -Binance
Importing the module
Now, when all the required packages are installed, let’s import the module and try to run our first script.
update the Binance Python library installation (if necessary)
Make sure the installation is updated by:
`Bash
Python-binance installation pyp3
After the update, try to import the module again:
`Python
Import binance
Error message ###
Unfortunately, even after installing the necessary packages and successfully importing the module, I found a syntax error when trying to use it.
What’s going on?
The “Binance” import manual does not recognize my Python 3.5 installation. The problem is probably caused by the fact that the library was installed for Python 3.6 or a newer system.
Solutions ###
To solve this problem, try to update the PIP version so that it corresponds to the required by Python-Binance (i.e. Python 3.5). Start:
`Bash
Python3 -M PIP installation -PIP
This should improve the syntax error and allow the module to be imported successfully.
Alternatively, you can also lower the PIP installation to use the older version of Python, which supports the Binance Python library:
`Bash
Sudo apt-get install python3.5-pip
PPIPI Instalnej -upgrade binance
Thanks to these steps you will be able to import the “Binance” module without finding syntactic errors.
Let me know if it helps!