MicroPython con esp8266 e esp32: installazione del firmware e utilizzo dell’IDE Thonny – 2
MicroPython è una snella implementazione del linguaggio di programmazione Python che è ottimizzata per l’uso su microcontrollori e sistemi embedded. È progettato per essere leggero, efficiente e facile da usare, e fornisce un modo per programmare microcontrollori usando codice Python.
Uno dei microcontrollori più popolari utilizzati con MicroPython è l’ESP8266 e l’ESP32, che sono microcontrollori a basso costo, abilitati al Wi-Fi e utilizzabili per una vasta gamma di progetti. In questo articolo, esploreremo come iniziare a usare MicroPython sull’ESP8266 e sull’ESP32 utilizzando Thonny, un popolare IDE Python.
Dettagli ESP32
Mi piacciono questi dispositivi. Sono molto potenti e a basso costo, con un microcontroller WIFI di grande valore.
Lo puoi trovare qui ESP32 Dev Kit v1 - TTGO T-Display 1.14 ESP32 - NodeMCU V3 V2 ESP8266 Lolin32 - NodeMCU ESP-32S - WeMos Lolin32 - WeMos Lolin32 mini - ESP32-CAM programmer - ESP32-CAM bundle - ESP32-WROOM-32 - ESP32-S
Specifiche
Ricorda che esistono molte varianti di questo dispositivo. Alcune hanno una funzioni particolari, qui una descrizione generica delle specifiche.
- Processori:
- CPU: processore Xtensa dual-core (o single-core) a 32 bit LX6, con frequenza di 160 o 240 MHz e capacità di esecuzione fino a 600 DMIPS
- Co-processore a bassissimo consumo energetico (ULP)
- Memoria: 520 KiB SRAM
- Connessione wireless:
- Wi-Fi: 802.11 b/g/n
- Bluetooth: v4.2 BR/EDR e BLE (condivide la radio con Wi-Fi)
- Interfacce periferiche:
- ADC SAR da 12 bit fino a 18 canali
- 2 × DAC a 8 bit
- 10 × sensori di tocco (GPIO con sensing capacitivo)
- 4 × SPI
- 2 × interfacce I²S
- 2 × interfacce I²C
- 3 × UART
- Controller host SD/SDIO/CE-ATA/MMC/eMMC
- Controller slave SDIO/SPI
- Interfaccia MAC Ethernet con DMA dedicato e supporto IEEE 1588 Precision Time Protocol
- CAN bus 2.0
- Telecomando infrarossi (TX/RX, fino a 8 canali)
- PWM per motori
- PWM per LED (fino a 16 canali)
- Sensore ad effetto Hall
- Preamplificatore analogico a bassissimo consumo energetico
- Sicurezza:
- Tutte le caratteristiche di sicurezza dello standard IEEE 802.11 supportate, inclusi WFA, WPA/WPA2 e WAPI
- Avvio sicuro
- Crittografia del flash
- OTP a 1024 bit, fino a 768 bit per i clienti
- Accelerazione hardware crittografica: AES, SHA-2, RSA, crittografia a curva ellittica (ECC), generatore di numeri casuali (RNG)
- Gestione dell’alimentazione:
- Regolatore di tensione a bassa caduta interno
- Dominio di alimentazione individuale per RTC
- Corrente di standby profondo di 5μA
- Sveglia da interruzione GPIO, timer, misurazioni ADC, interruzione del sensore di tocco capacitivo
Piedinatura
ESP32 DEV KIT v1
ESP32 DevKIT v4
ESP32 WeMos LOLIN32
Questo dispositivo è molto potente e puoi vedere che ci sono pin touch capacitivi, più di un UART e vari pin analogici.
How To
Devi scaricare i driver per il chip USB, probabilmente hai una versione esp32 con cp2102, ma esistono varianti con il chip ch340.
Dettagli ESP8266
Puoi trovarlo qui WeMos D1 mini - NodeMCU V2 V2.1 V3 - esp01 - esp01 programmer
Specifiche
- Processore: core microprocessore L106 a 32 bit RISC basato su Tensilica Xtensa Diamond Standard 106Micro con frequenza di 80 MHz[5]
- Memoria:
- 32 KiB RAM di istruzioni
- 32 KiB RAM di cache di istruzioni
- 80 KiB RAM di dati utente
- 16 KiB RAM di dati di sistema ETS
- Flash QSPI esterna: supportato fino a 16 MiB (di solito incluso da 512 KiB a 4 MiB)
- Wi-Fi IEEE 802.11 b/g/n integrato
- Switch TR integrato, balun, LNA, amplificatore di potenza e rete di adattamento
- Autenticazione WEP o WPA/WPA2, o reti aperte
- 16 pin GPIO
- SPI
- I²C (implementazione software)
- Interfacce I²S con DMA (condivisione dei pin con GPIO)
- UART su pin dedicati, oltre a una UART solo di trasmissione, abilitabile su GPIO2
- ADC a 10 bit (ADC a approssimazioni successive)
Pinouts
Wemos D1 mini
WeMos D1 mini immagine ad alta risoluzione
NodeMCU V2
NodeMCU v2.x immagine ad alta risoluzione
NodeMCU v2.1
NodeMCU v2.x immagine ad alta risoluzione
NodeMCU v3
Penso che la cosa interessante sia che ha più di un Hardware Serial, quindi puoi utilizzare Serial per la comunicazione con i dispositivi e Serial1 D4 (solo trasmissione) per il debug.
Driver
Puoi scaricare i driver per i chip USB qui, controlla la tua versione di D1 mini e clicca su driver.
Ecco una lista più esaustiva di dispositivi.
- Arduino
- esp8285
- esp8266
- ESP32
- ESP32 s2
- ESP32c3
- ESP32s3
- VCC-GND Studio YD-ESP32-S3
- ESP32-S3 DevKitC 1
- WeAct ESP32 S3 A
- WeMos LOLIN S3
- WeMos LOLIN S3 Pro
- Arduino SAMD
- STM32
- Raspberry Pi
Introduzione a Thonny IDE
Thonny è un IDE Python che ha guadagnato popolarità tra gli sviluppatori per la sua semplicità e facilità d’uso. È uno strumento fantastico per i principianti che stanno appena iniziando con Python, così come per gli sviluppatori esperti che cercano un ambiente di sviluppo snello.
Una delle caratteristiche che fanno risaltare Thonny è il suo plugin MicroPython. Questo plugin permette agli sviluppatori di utilizzare Thonny per scrivere, testare e debuggare codice sui microcontrollori che eseguono MicroPython, come l’ESP8266 e l’ESP32.
Quando si lavora con i microcontrollori, gli sviluppatori utilizzano tipicamente un emulatore di terminale seriale per interagire con il dispositivo. Con Thonny, tuttavia, gli sviluppatori possono utilizzare un’interfaccia IDE familiare per scrivere e debuggare il codice sui loro microcontrollori.
Il plugin MicroPython di Thonny fornisce diverse funzionalità utili per lavorare con MicroPython sui microcontrollori. Questi includono:
- Gestione dispositivi: Il gestore di dispositivi di Thonny consente agli sviluppatori di collegarsi ai loro microcontrollori e gestire facilmente le loro connessioni. Fornisce un’interfaccia semplice per la selezione del tipo di dispositivo e della porta e per l’installazione del firmware MicroPython sul dispositivo.
- Console interattiva: la console interattiva di Thonny consente agli sviluppatori di interagire in tempo reale con il loro microcontrollore utilizzando una shell Python. Questo può essere utile per testare il codice e risolvere i problemi.
- Editor di codice: l’editor di codice di Thonny fornisce un editor di testo completo con evidenziazione della sintassi, completamento del codice e supporto al debug. Gli sviluppatori possono scrivere codice per il loro microcontrollore direttamente nell’editor e utilizzare il debugger di Thonny per identificare e risolvere i problemi.
Utilizzando Thonny con il plugin MicroPython, gli sviluppatori possono semplificare il processo di sviluppo e migliorare l’affidabilità del loro codice. Thonny fornisce un’interfaccia user-friendly per lavorare con i microcontrollori, e il plugin MicroPython fornisce tutti gli strumenti necessari per scrivere, testare e debuggare il codice.
Installare Thonny
Thonny è un IDE Python gratuito e open-source disponibile per Windows, macOS e Linux. È possibile scaricare Thonny dal sito ufficiale all’indirizzo https://thonny.org.
Per semplificare il processo, installeremo la versione con una versione integrata di Python (il primo link nell’elenco dei download).
Seguire tutto il processo di installazione.
Utilizzo di Thonny per caricare il firmware MicroPython su esp32 e esp8266
Scaricare il firmware MicroPython per esp32 e esp8266
Per installare MicroPython sulla tua scheda ESP8266 o ESP32, dovrai scaricare il firmware dal sito ufficiale di MicroPython. Il firmware è disponibile in forma binaria per una varietà di microcontrollori, tra cui ESP8266 e ESP32.
Scarica il firmware
- Per scaricare il firmware per ESP8266, vai al seguente URL:
- Per scaricare il firmware per ESP32, vai al seguente URL:
Ora su Thonny, vai a Strumenti --> Opzioni...
Dopo di che, apparirà un collegamento nella parte inferiore del pannello.
Si apre un pannello per l’installatore del firmware ESP8266.
Dovrai selezionare la porta seriale dal combo e il firmware precedentemente scaricato.
Poi clicca su Installa, alla fine, avrai il firmware MicroPython installato sul dispositivo.
Esecuzione del primo sketch
Ora possiamo eseguire un semplice sketch che stampa una stringa nella console.
Ecco lo sketch:
print("Hello from www.mischianti.org")
Ecco il risultato:
>>> %Run -c $EDITOR_CONTENT
Hello from www.mischianti.org
>>>
Uno sketch che interagisce con le periferiche del microcontrollore
Ora stiamo per eseguire un programma che utilizza il pacchetto machine
, la libreria per interagire con pin, SPI, i2c ecc.
import machine
import time
pin = machine.Pin(2, machine.Pin.OUT)
while True:
pin.value(0)
time.sleep(0.5)
pin.value(1)
time.sleep(0.5)
Ma abbiamo una cattiva risposta.
Traceback (most recent cell last):
File D:/projects/micropython/testesp/main.py", line 1, in <module>
import machine
ModuleNotFoundError: No module named 'machine'
Come puoi vedere, MicroPython risponde che manca il pacchetto ‘machine’.
Installazione di un nuovo pacchetto MicroPython
Questo processo non dovrebbe essere necessario in generale per il pacchetto machine
, ma inserisco comunque una eventuale soluzione
Per installare il pacchetto, devi andare su Strumenti --> Gestisci Pacchetti...
Ora cerca machine
, clicca su di esso, e poi clicca su Installa
.
Nel mio caso, ottengo un nuovo errore, e metto qui il log completo.
install --user machine
Collecting machine
Using cached machine-0.0.1-py2.py3-none-any.whl (4.2 kB)
Collecting pycrypto
Using cached pycrypto-2.6.1.tar.gz (446 kB)
Preparing metadata (setup.py): started
Preparing metadata (setup.py): finished with status 'done'
Building wheels for collected packages: pycrypto
Building wheel for pycrypto (setup.py): started
Building wheel for pycrypto (setup.py): finished with status 'error'
error: subprocess-exited-with-error
× python setup.py bdist_wheel did not run successfully.
│ exit code: 1
╰─> [179 lines of output]
running bdist_wheel
running build
running build_py
creating build
creating build\lib.win-amd64-cpython-310
creating build\lib.win-amd64-cpython-310\Crypto
copying lib\Crypto\pct_warnings.py -> build\lib.win-amd64-cpython-310\Crypto
copying lib\Crypto\__init__.py -> build\lib.win-amd64-cpython-310\Crypto
creating build\lib.win-amd64-cpython-310\Crypto\Hash
copying lib\Crypto\Hash\hashalgo.py -> build\lib.win-amd64-cpython-310\Crypto\Hash
copying lib\Crypto\Hash\HMAC.py -> build\lib.win-amd64-cpython-310\Crypto\Hash
copying lib\Crypto\Hash\MD2.py -> build\lib.win-amd64-cpython-310\Crypto\Hash
copying lib\Crypto\Hash\MD4.py -> build\lib.win-amd64-cpython-310\Crypto\Hash
copying lib\Crypto\Hash\MD5.py -> build\lib.win-amd64-cpython-310\Crypto\Hash
copying lib\Crypto\Hash\RIPEMD.py -> build\lib.win-amd64-cpython-310\Crypto\Hash
copying lib\Crypto\Hash\SHA.py -> build\lib.win-amd64-cpython-310\Crypto\Hash
copying lib\Crypto\Hash\SHA224.py -> build\lib.win-amd64-cpython-310\Crypto\Hash
copying lib\Crypto\Hash\SHA256.py -> build\lib.win-amd64-cpython-310\Crypto\Hash
copying lib\Crypto\Hash\SHA384.py -> build\lib.win-amd64-cpython-310\Crypto\Hash
copying lib\Crypto\Hash\SHA512.py -> build\lib.win-amd64-cpython-310\Crypto\Hash
copying lib\Crypto\Hash\__init__.py -> build\lib.win-amd64-cpython-310\Crypto\Hash
creating build\lib.win-amd64-cpython-310\Crypto\Cipher
copying lib\Crypto\Cipher\AES.py -> build\lib.win-amd64-cpython-310\Crypto\Cipher
copying lib\Crypto\Cipher\ARC2.py -> build\lib.win-amd64-cpython-310\Crypto\Cipher
copying lib\Crypto\Cipher\ARC4.py -> build\lib.win-amd64-cpython-310\Crypto\Cipher
copying lib\Crypto\Cipher\blockalgo.py -> build\lib.win-amd64-cpython-310\Crypto\Cipher
copying lib\Crypto\Cipher\Blowfish.py -> build\lib.win-amd64-cpython-310\Crypto\Cipher
copying lib\Crypto\Cipher\CAST.py -> build\lib.win-amd64-cpython-310\Crypto\Cipher
copying lib\Crypto\Cipher\DES.py -> build\lib.win-amd64-cpython-310\Crypto\Cipher
copying lib\Crypto\Cipher\DES3.py -> build\lib.win-amd64-cpython-310\Crypto\Cipher
copying lib\Crypto\Cipher\PKCS1_OAEP.py -> build\lib.win-amd64-cpython-310\Crypto\Cipher
copying lib\Crypto\Cipher\PKCS1_v1_5.py -> build\lib.win-amd64-cpython-310\Crypto\Cipher
copying lib\Crypto\Cipher\XOR.py -> build\lib.win-amd64-cpython-310\Crypto\Cipher
copying lib\Crypto\Cipher\__init__.py -> build\lib.win-amd64-cpython-310\Crypto\Cipher
creating build\lib.win-amd64-cpython-310\Crypto\Util
copying lib\Crypto\Util\asn1.py -> build\lib.win-amd64-cpython-310\Crypto\Util
copying lib\Crypto\Util\Counter.py -> build\lib.win-amd64-cpython-310\Crypto\Util
copying lib\Crypto\Util\number.py -> build\lib.win-amd64-cpython-310\Crypto\Util
copying lib\Crypto\Util\py3compat.py -> build\lib.win-amd64-cpython-310\Crypto\Util
copying lib\Crypto\Util\randpool.py -> build\lib.win-amd64-cpython-310\Crypto\Util
copying lib\Crypto\Util\RFC1751.py -> build\lib.win-amd64-cpython-310\Crypto\Util
copying lib\Crypto\Util\winrandom.py -> build\lib.win-amd64-cpython-310\Crypto\Util
copying lib\Crypto\Util\_number_new.py -> build\lib.win-amd64-cpython-310\Crypto\Util
copying lib\Crypto\Util\__init__.py -> build\lib.win-amd64-cpython-310\Crypto\Util
creating build\lib.win-amd64-cpython-310\Crypto\Random
copying lib\Crypto\Random\random.py -> build\lib.win-amd64-cpython-310\Crypto\Random
copying lib\Crypto\Random\_UserFriendlyRNG.py -> build\lib.win-amd64-cpython-310\Crypto\Random
copying lib\Crypto\Random\__init__.py -> build\lib.win-amd64-cpython-310\Crypto\Random
creating build\lib.win-amd64-cpython-310\Crypto\Random\Fortuna
copying lib\Crypto\Random\Fortuna\FortunaAccumulator.py -> build\lib.win-amd64-cpython-310\Crypto\Random\Fortuna
copying lib\Crypto\Random\Fortuna\FortunaGenerator.py -> build\lib.win-amd64-cpython-310\Crypto\Random\Fortuna
copying lib\Crypto\Random\Fortuna\SHAd256.py -> build\lib.win-amd64-cpython-310\Crypto\Random\Fortuna
copying lib\Crypto\Random\Fortuna\__init__.py -> build\lib.win-amd64-cpython-310\Crypto\Random\Fortuna
creating build\lib.win-amd64-cpython-310\Crypto\Random\OSRNG
copying lib\Crypto\Random\OSRNG\fallback.py -> build\lib.win-amd64-cpython-310\Crypto\Random\OSRNG
copying lib\Crypto\Random\OSRNG\nt.py -> build\lib.win-amd64-cpython-310\Crypto\Random\OSRNG
copying lib\Crypto\Random\OSRNG\posix.py -> build\lib.win-amd64-cpython-310\Crypto\Random\OSRNG
copying lib\Crypto\Random\OSRNG\rng_base.py -> build\lib.win-amd64-cpython-310\Crypto\Random\OSRNG
copying lib\Crypto\Random\OSRNG\__init__.py -> build\lib.win-amd64-cpython-310\Crypto\Random\OSRNG
creating build\lib.win-amd64-cpython-310\Crypto\SelfTest
copying lib\Crypto\SelfTest\st_common.py -> build\lib.win-amd64-cpython-310\Crypto\SelfTest
copying lib\Crypto\SelfTest\__init__.py -> build\lib.win-amd64-cpython-310\Crypto\SelfTest
creating build\lib.win-amd64-cpython-310\Crypto\SelfTest\Cipher
copying lib\Crypto\SelfTest\Cipher\common.py -> build\lib.win-amd64-cpython-310\Crypto\SelfTest\Cipher
copying lib\Crypto\SelfTest\Cipher\test_AES.py -> build\lib.win-amd64-cpython-310\Crypto\SelfTest\Cipher
copying lib\Crypto\SelfTest\Cipher\test_ARC2.py -> build\lib.win-amd64-cpython-310\Crypto\SelfTest\Cipher
copying lib\Crypto\SelfTest\Cipher\test_ARC4.py -> build\lib.win-amd64-cpython-310\Crypto\SelfTest\Cipher
copying lib\Crypto\SelfTest\Cipher\test_Blowfish.py -> build\lib.win-amd64-cpython-310\Crypto\SelfTest\Cipher
copying lib\Crypto\SelfTest\Cipher\test_CAST.py -> build\lib.win-amd64-cpython-310\Crypto\SelfTest\Cipher
copying lib\Crypto\SelfTest\Cipher\test_DES.py -> build\lib.win-amd64-cpython-310\Crypto\SelfTest\Cipher
copying lib\Crypto\SelfTest\Cipher\test_DES3.py -> build\lib.win-amd64-cpython-310\Crypto\SelfTest\Cipher
copying lib\Crypto\SelfTest\Cipher\test_pkcs1_15.py -> build\lib.win-amd64-cpython-310\Crypto\SelfTest\Cipher
copying lib\Crypto\SelfTest\Cipher\test_pkcs1_oaep.py -> build\lib.win-amd64-cpython-310\Crypto\SelfTest\Cipher
copying lib\Crypto\SelfTest\Cipher\test_XOR.py -> build\lib.win-amd64-cpython-310\Crypto\SelfTest\Cipher
copying lib\Crypto\SelfTest\Cipher\__init__.py -> build\lib.win-amd64-cpython-310\Crypto\SelfTest\Cipher
creating build\lib.win-amd64-cpython-310\Crypto\SelfTest\Hash
copying lib\Crypto\SelfTest\Hash\common.py -> build\lib.win-amd64-cpython-310\Crypto\SelfTest\Hash
copying lib\Crypto\SelfTest\Hash\test_HMAC.py -> build\lib.win-amd64-cpython-310\Crypto\SelfTest\Hash
copying lib\Crypto\SelfTest\Hash\test_MD2.py -> build\lib.win-amd64-cpython-310\Crypto\SelfTest\Hash
copying lib\Crypto\SelfTest\Hash\test_MD4.py -> build\lib.win-amd64-cpython-310\Crypto\SelfTest\Hash
copying lib\Crypto\SelfTest\Hash\test_MD5.py -> build\lib.win-amd64-cpython-310\Crypto\SelfTest\Hash
copying lib\Crypto\SelfTest\Hash\test_RIPEMD.py -> build\lib.win-amd64-cpython-310\Crypto\SelfTest\Hash
copying lib\Crypto\SelfTest\Hash\test_SHA.py -> build\lib.win-amd64-cpython-310\Crypto\SelfTest\Hash
copying lib\Crypto\SelfTest\Hash\test_SHA224.py -> build\lib.win-amd64-cpython-310\Crypto\SelfTest\Hash
copying lib\Crypto\SelfTest\Hash\test_SHA256.py -> build\lib.win-amd64-cpython-310\Crypto\SelfTest\Hash
copying lib\Crypto\SelfTest\Hash\test_SHA384.py -> build\lib.win-amd64-cpython-310\Crypto\SelfTest\Hash
copying lib\Crypto\SelfTest\Hash\test_SHA512.py -> build\lib.win-amd64-cpython-310\Crypto\SelfTest\Hash
copying lib\Crypto\SelfTest\Hash\__init__.py -> build\lib.win-amd64-cpython-310\Crypto\SelfTest\Hash
creating build\lib.win-amd64-cpython-310\Crypto\SelfTest\Protocol
copying lib\Crypto\SelfTest\Protocol\test_AllOrNothing.py -> build\lib.win-amd64-cpython-310\Crypto\SelfTest\Protocol
copying lib\Crypto\SelfTest\Protocol\test_chaffing.py -> build\lib.win-amd64-cpython-310\Crypto\SelfTest\Protocol
copying lib\Crypto\SelfTest\Protocol\test_KDF.py -> build\lib.win-amd64-cpython-310\Crypto\SelfTest\Protocol
copying lib\Crypto\SelfTest\Protocol\test_rfc1751.py -> build\lib.win-amd64-cpython-310\Crypto\SelfTest\Protocol
copying lib\Crypto\SelfTest\Protocol\__init__.py -> build\lib.win-amd64-cpython-310\Crypto\SelfTest\Protocol
creating build\lib.win-amd64-cpython-310\Crypto\SelfTest\PublicKey
copying lib\Crypto\SelfTest\PublicKey\test_DSA.py -> build\lib.win-amd64-cpython-310\Crypto\SelfTest\PublicKey
copying lib\Crypto\SelfTest\PublicKey\test_ElGamal.py -> build\lib.win-amd64-cpython-310\Crypto\SelfTest\PublicKey
copying lib\Crypto\SelfTest\PublicKey\test_importKey.py -> build\lib.win-amd64-cpython-310\Crypto\SelfTest\PublicKey
copying lib\Crypto\SelfTest\PublicKey\test_RSA.py -> build\lib.win-amd64-cpython-310\Crypto\SelfTest\PublicKey
copying lib\Crypto\SelfTest\PublicKey\__init__.py -> build\lib.win-amd64-cpython-310\Crypto\SelfTest\PublicKey
creating build\lib.win-amd64-cpython-310\Crypto\SelfTest\Random
copying lib\Crypto\SelfTest\Random\test_random.py -> build\lib.win-amd64-cpython-310\Crypto\SelfTest\Random
copying lib\Crypto\SelfTest\Random\test_rpoolcompat.py -> build\lib.win-amd64-cpython-310\Crypto\SelfTest\Random
copying lib\Crypto\SelfTest\Random\test__UserFriendlyRNG.py -> build\lib.win-amd64-cpython-310\Crypto\SelfTest\Random
copying lib\Crypto\SelfTest\Random\__init__.py -> build\lib.win-amd64-cpython-310\Crypto\SelfTest\Random
creating build\lib.win-amd64-cpython-310\Crypto\SelfTest\Random\Fortuna
copying lib\Crypto\SelfTest\Random\Fortuna\test_FortunaAccumulator.py -> build\lib.win-amd64-cpython-310\Crypto\SelfTest\Random\Fortuna
copying lib\Crypto\SelfTest\Random\Fortuna\test_FortunaGenerator.py -> build\lib.win-amd64-cpython-310\Crypto\SelfTest\Random\Fortuna
copying lib\Crypto\SelfTest\Random\Fortuna\test_SHAd256.py -> build\lib.win-amd64-cpython-310\Crypto\SelfTest\Random\Fortuna
copying lib\Crypto\SelfTest\Random\Fortuna\__init__.py -> build\lib.win-amd64-cpython-310\Crypto\SelfTest\Random\Fortuna
creating build\lib.win-amd64-cpython-310\Crypto\SelfTest\Random\OSRNG
copying lib\Crypto\SelfTest\Random\OSRNG\test_fallback.py -> build\lib.win-amd64-cpython-310\Crypto\SelfTest\Random\OSRNG
copying lib\Crypto\SelfTest\Random\OSRNG\test_generic.py -> build\lib.win-amd64-cpython-310\Crypto\SelfTest\Random\OSRNG
copying lib\Crypto\SelfTest\Random\OSRNG\test_nt.py -> build\lib.win-amd64-cpython-310\Crypto\SelfTest\Random\OSRNG
copying lib\Crypto\SelfTest\Random\OSRNG\test_posix.py -> build\lib.win-amd64-cpython-310\Crypto\SelfTest\Random\OSRNG
copying lib\Crypto\SelfTest\Random\OSRNG\test_winrandom.py -> build\lib.win-amd64-cpython-310\Crypto\SelfTest\Random\OSRNG
copying lib\Crypto\SelfTest\Random\OSRNG\__init__.py -> build\lib.win-amd64-cpython-310\Crypto\SelfTest\Random\OSRNG
creating build\lib.win-amd64-cpython-310\Crypto\SelfTest\Util
copying lib\Crypto\SelfTest\Util\test_asn1.py -> build\lib.win-amd64-cpython-310\Crypto\SelfTest\Util
copying lib\Crypto\SelfTest\Util\test_Counter.py -> build\lib.win-amd64-cpython-310\Crypto\SelfTest\Util
copying lib\Crypto\SelfTest\Util\test_number.py -> build\lib.win-amd64-cpython-310\Crypto\SelfTest\Util
copying lib\Crypto\SelfTest\Util\test_winrandom.py -> build\lib.win-amd64-cpython-310\Crypto\SelfTest\Util
copying lib\Crypto\SelfTest\Util\__init__.py -> build\lib.win-amd64-cpython-310\Crypto\SelfTest\Util
creating build\lib.win-amd64-cpython-310\Crypto\SelfTest\Signature
copying lib\Crypto\SelfTest\Signature\test_pkcs1_15.py -> build\lib.win-amd64-cpython-310\Crypto\SelfTest\Signature
copying lib\Crypto\SelfTest\Signature\test_pkcs1_pss.py -> build\lib.win-amd64-cpython-310\Crypto\SelfTest\Signature
copying lib\Crypto\SelfTest\Signature\__init__.py -> build\lib.win-amd64-cpython-310\Crypto\SelfTest\Signature
creating build\lib.win-amd64-cpython-310\Crypto\Protocol
copying lib\Crypto\Protocol\AllOrNothing.py -> build\lib.win-amd64-cpython-310\Crypto\Protocol
copying lib\Crypto\Protocol\Chaffing.py -> build\lib.win-amd64-cpython-310\Crypto\Protocol
copying lib\Crypto\Protocol\KDF.py -> build\lib.win-amd64-cpython-310\Crypto\Protocol
copying lib\Crypto\Protocol\__init__.py -> build\lib.win-amd64-cpython-310\Crypto\Protocol
creating build\lib.win-amd64-cpython-310\Crypto\PublicKey
copying lib\Crypto\PublicKey\DSA.py -> build\lib.win-amd64-cpython-310\Crypto\PublicKey
copying lib\Crypto\PublicKey\ElGamal.py -> build\lib.win-amd64-cpython-310\Crypto\PublicKey
copying lib\Crypto\PublicKey\pubkey.py -> build\lib.win-amd64-cpython-310\Crypto\PublicKey
copying lib\Crypto\PublicKey\RSA.py -> build\lib.win-amd64-cpython-310\Crypto\PublicKey
copying lib\Crypto\PublicKey\_DSA.py -> build\lib.win-amd64-cpython-310\Crypto\PublicKey
copying lib\Crypto\PublicKey\_RSA.py -> build\lib.win-amd64-cpython-310\Crypto\PublicKey
copying lib\Crypto\PublicKey\_slowmath.py -> build\lib.win-amd64-cpython-310\Crypto\PublicKey
copying lib\Crypto\PublicKey\__init__.py -> build\lib.win-amd64-cpython-310\Crypto\PublicKey
creating build\lib.win-amd64-cpython-310\Crypto\Signature
copying lib\Crypto\Signature\PKCS1_PSS.py -> build\lib.win-amd64-cpython-310\Crypto\Signature
copying lib\Crypto\Signature\PKCS1_v1_5.py -> build\lib.win-amd64-cpython-310\Crypto\Signature
copying lib\Crypto\Signature\__init__.py -> build\lib.win-amd64-cpython-310\Crypto\Signature
running build_ext
warning: GMP or MPIR library not found; Not building Crypto.PublicKey._fastmath.
building 'Crypto.Random.OSRNG.winrandom' extension
creating build\temp.win-amd64-cpython-310
creating build\temp.win-amd64-cpython-310\Release
creating build\temp.win-amd64-cpython-310\Release\src
"C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Tools\MSVC\14.16.27023\bin\HostX86\x64\cl.exe" /c /nologo /O2 /W3 /GL /DNDEBUG /MD -Isrc/ -Isrc/inc-msvc/ -IC:\Users\renzo\AppData\Local\Programs\Thonny\include -IC:\Users\renzo\AppData\Local\Programs\Thonny\Include "-IC:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Tools\MSVC\14.16.27023\include" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\winrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\cppwinrt" /Tcsrc/winrand.c /Fobuild\temp.win-amd64-cpython-310\Release\src/winrand.obj
winrand.c
C:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\ucrt\inttypes.h(27): error C2061: errore di sintassi: identificatore 'intmax_t'
C:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\ucrt\inttypes.h(28): error C2061: errore di sintassi: identificatore 'rem'
C:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\ucrt\inttypes.h(28): error C2059: errore di sintassi: ';'
C:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\ucrt\inttypes.h(29): error C2059: errore di sintassi: '}'
C:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\ucrt\inttypes.h(31): error C2061: errore di sintassi: identificatore 'imaxdiv_t'
C:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\ucrt\inttypes.h(31): error C2059: errore di sintassi: ';'
C:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\ucrt\inttypes.h(41): error C2143: errore di sintassi: '{' mancante prima di '__cdecl'
C:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\ucrt\inttypes.h(42): error C2146: errore di sintassi: ')' mancante prima dell'identificatore '_Number'
C:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\ucrt\inttypes.h(42): error C2061: errore di sintassi: identificatore '_Number'
C:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\ucrt\inttypes.h(42): error C2059: errore di sintassi: ';'
C:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\ucrt\inttypes.h(43): error C2059: errore di sintassi: ')'
C:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\ucrt\inttypes.h(46): error C2143: errore di sintassi: '{' mancante prima di '__cdecl'
C:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\ucrt\inttypes.h(47): error C2146: errore di sintassi: ')' mancante prima dell'identificatore '_Numerator'
C:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\ucrt\inttypes.h(47): error C2061: errore di sintassi: identificatore '_Numerator'
C:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\ucrt\inttypes.h(47): error C2059: errore di sintassi: ';'
C:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\ucrt\inttypes.h(47): error C2059: errore di sintassi: ','
C:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\ucrt\inttypes.h(49): error C2059: errore di sintassi: ')'
C:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\ucrt\inttypes.h(51): error C2143: errore di sintassi: '{' mancante prima di '__cdecl'
C:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\ucrt\inttypes.h(57): error C2143: errore di sintassi: '{' mancante prima di '__cdecl'
C:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\ucrt\inttypes.h(64): error C2143: errore di sintassi: '{' mancante prima di '__cdecl'
C:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\ucrt\inttypes.h(70): error C2143: errore di sintassi: '{' mancante prima di '__cdecl'
C:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\ucrt\inttypes.h(77): error C2143: errore di sintassi: '{' mancante prima di '__cdecl'
C:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\ucrt\inttypes.h(83): error C2143: errore di sintassi: '{' mancante prima di '__cdecl'
C:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\ucrt\inttypes.h(90): error C2143: errore di sintassi: '{' mancante prima di '__cdecl'
C:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\ucrt\inttypes.h(96): error C2143: errore di sintassi: '{' mancante prima di '__cdecl'
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\BuildTools\\VC\\Tools\\MSVC\\14.16.27023\\bin\\HostX86\\x64\\cl.exe' failed with exit code 2
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for pycrypto
Running setup.py clean for pycrypto
Failed to build pycrypto
Installing collected packages: pycrypto, machine
Running setup.py install for pycrypto: started
Running setup.py install for pycrypto: finished with status 'error'
error: subprocess-exited-with-error
× Running setup.py install for pycrypto did not run successfully.
│ exit code: 1
╰─> [181 lines of output]
running install
C:\Users\renzo\AppData\Local\Programs\Thonny\lib\site-packages\setuptools\command\install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
warnings.warn(
running build
running build_py
creating build
creating build\lib.win-amd64-cpython-310
creating build\lib.win-amd64-cpython-310\Crypto
copying lib\Crypto\pct_warnings.py -> build\lib.win-amd64-cpython-310\Crypto
copying lib\Crypto\__init__.py -> build\lib.win-amd64-cpython-310\Crypto
creating build\lib.win-amd64-cpython-310\Crypto\Hash
copying lib\Crypto\Hash\hashalgo.py -> build\lib.win-amd64-cpython-310\Crypto\Hash
copying lib\Crypto\Hash\HMAC.py -> build\lib.win-amd64-cpython-310\Crypto\Hash
copying lib\Crypto\Hash\MD2.py -> build\lib.win-amd64-cpython-310\Crypto\Hash
copying lib\Crypto\Hash\MD4.py -> build\lib.win-amd64-cpython-310\Crypto\Hash
copying lib\Crypto\Hash\MD5.py -> build\lib.win-amd64-cpython-310\Crypto\Hash
copying lib\Crypto\Hash\RIPEMD.py -> build\lib.win-amd64-cpython-310\Crypto\Hash
copying lib\Crypto\Hash\SHA.py -> build\lib.win-amd64-cpython-310\Crypto\Hash
copying lib\Crypto\Hash\SHA224.py -> build\lib.win-amd64-cpython-310\Crypto\Hash
copying lib\Crypto\Hash\SHA256.py -> build\lib.win-amd64-cpython-310\Crypto\Hash
copying lib\Crypto\Hash\SHA384.py -> build\lib.win-amd64-cpython-310\Crypto\Hash
copying lib\Crypto\Hash\SHA512.py -> build\lib.win-amd64-cpython-310\Crypto\Hash
copying lib\Crypto\Hash\__init__.py -> build\lib.win-amd64-cpython-310\Crypto\Hash
creating build\lib.win-amd64-cpython-310\Crypto\Cipher
copying lib\Crypto\Cipher\AES.py -> build\lib.win-amd64-cpython-310\Crypto\Cipher
copying lib\Crypto\Cipher\ARC2.py -> build\lib.win-amd64-cpython-310\Crypto\Cipher
copying lib\Crypto\Cipher\ARC4.py -> build\lib.win-amd64-cpython-310\Crypto\Cipher
copying lib\Crypto\Cipher\blockalgo.py -> build\lib.win-amd64-cpython-310\Crypto\Cipher
copying lib\Crypto\Cipher\Blowfish.py -> build\lib.win-amd64-cpython-310\Crypto\Cipher
copying lib\Crypto\Cipher\CAST.py -> build\lib.win-amd64-cpython-310\Crypto\Cipher
copying lib\Crypto\Cipher\DES.py -> build\lib.win-amd64-cpython-310\Crypto\Cipher
copying lib\Crypto\Cipher\DES3.py -> build\lib.win-amd64-cpython-310\Crypto\Cipher
copying lib\Crypto\Cipher\PKCS1_OAEP.py -> build\lib.win-amd64-cpython-310\Crypto\Cipher
copying lib\Crypto\Cipher\PKCS1_v1_5.py -> build\lib.win-amd64-cpython-310\Crypto\Cipher
copying lib\Crypto\Cipher\XOR.py -> build\lib.win-amd64-cpython-310\Crypto\Cipher
copying lib\Crypto\Cipher\__init__.py -> build\lib.win-amd64-cpython-310\Crypto\Cipher
creating build\lib.win-amd64-cpython-310\Crypto\Util
copying lib\Crypto\Util\asn1.py -> build\lib.win-amd64-cpython-310\Crypto\Util
copying lib\Crypto\Util\Counter.py -> build\lib.win-amd64-cpython-310\Crypto\Util
copying lib\Crypto\Util\number.py -> build\lib.win-amd64-cpython-310\Crypto\Util
copying lib\Crypto\Util\py3compat.py -> build\lib.win-amd64-cpython-310\Crypto\Util
copying lib\Crypto\Util\randpool.py -> build\lib.win-amd64-cpython-310\Crypto\Util
copying lib\Crypto\Util\RFC1751.py -> build\lib.win-amd64-cpython-310\Crypto\Util
copying lib\Crypto\Util\winrandom.py -> build\lib.win-amd64-cpython-310\Crypto\Util
copying lib\Crypto\Util\_number_new.py -> build\lib.win-amd64-cpython-310\Crypto\Util
copying lib\Crypto\Util\__init__.py -> build\lib.win-amd64-cpython-310\Crypto\Util
creating build\lib.win-amd64-cpython-310\Crypto\Random
copying lib\Crypto\Random\random.py -> build\lib.win-amd64-cpython-310\Crypto\Random
copying lib\Crypto\Random\_UserFriendlyRNG.py -> build\lib.win-amd64-cpython-310\Crypto\Random
copying lib\Crypto\Random\__init__.py -> build\lib.win-amd64-cpython-310\Crypto\Random
creating build\lib.win-amd64-cpython-310\Crypto\Random\Fortuna
copying lib\Crypto\Random\Fortuna\FortunaAccumulator.py -> build\lib.win-amd64-cpython-310\Crypto\Random\Fortuna
copying lib\Crypto\Random\Fortuna\FortunaGenerator.py -> build\lib.win-amd64-cpython-310\Crypto\Random\Fortuna
copying lib\Crypto\Random\Fortuna\SHAd256.py -> build\lib.win-amd64-cpython-310\Crypto\Random\Fortuna
copying lib\Crypto\Random\Fortuna\__init__.py -> build\lib.win-amd64-cpython-310\Crypto\Random\Fortuna
creating build\lib.win-amd64-cpython-310\Crypto\Random\OSRNG
copying lib\Crypto\Random\OSRNG\fallback.py -> build\lib.win-amd64-cpython-310\Crypto\Random\OSRNG
copying lib\Crypto\Random\OSRNG\nt.py -> build\lib.win-amd64-cpython-310\Crypto\Random\OSRNG
copying lib\Crypto\Random\OSRNG\posix.py -> build\lib.win-amd64-cpython-310\Crypto\Random\OSRNG
copying lib\Crypto\Random\OSRNG\rng_base.py -> build\lib.win-amd64-cpython-310\Crypto\Random\OSRNG
copying lib\Crypto\Random\OSRNG\__init__.py -> build\lib.win-amd64-cpython-310\Crypto\Random\OSRNG
creating build\lib.win-amd64-cpython-310\Crypto\SelfTest
copying lib\Crypto\SelfTest\st_common.py -> build\lib.win-amd64-cpython-310\Crypto\SelfTest
copying lib\Crypto\SelfTest\__init__.py -> build\lib.win-amd64-cpython-310\Crypto\SelfTest
creating build\lib.win-amd64-cpython-310\Crypto\SelfTest\Cipher
copying lib\Crypto\SelfTest\Cipher\common.py -> build\lib.win-amd64-cpython-310\Crypto\SelfTest\Cipher
copying lib\Crypto\SelfTest\Cipher\test_AES.py -> build\lib.win-amd64-cpython-310\Crypto\SelfTest\Cipher
copying lib\Crypto\SelfTest\Cipher\test_ARC2.py -> build\lib.win-amd64-cpython-310\Crypto\SelfTest\Cipher
copying lib\Crypto\SelfTest\Cipher\test_ARC4.py -> build\lib.win-amd64-cpython-310\Crypto\SelfTest\Cipher
copying lib\Crypto\SelfTest\Cipher\test_Blowfish.py -> build\lib.win-amd64-cpython-310\Crypto\SelfTest\Cipher
copying lib\Crypto\SelfTest\Cipher\test_CAST.py -> build\lib.win-amd64-cpython-310\Crypto\SelfTest\Cipher
copying lib\Crypto\SelfTest\Cipher\test_DES.py -> build\lib.win-amd64-cpython-310\Crypto\SelfTest\Cipher
copying lib\Crypto\SelfTest\Cipher\test_DES3.py -> build\lib.win-amd64-cpython-310\Crypto\SelfTest\Cipher
copying lib\Crypto\SelfTest\Cipher\test_pkcs1_15.py -> build\lib.win-amd64-cpython-310\Crypto\SelfTest\Cipher
copying lib\Crypto\SelfTest\Cipher\test_pkcs1_oaep.py -> build\lib.win-amd64-cpython-310\Crypto\SelfTest\Cipher
copying lib\Crypto\SelfTest\Cipher\test_XOR.py -> build\lib.win-amd64-cpython-310\Crypto\SelfTest\Cipher
copying lib\Crypto\SelfTest\Cipher\__init__.py -> build\lib.win-amd64-cpython-310\Crypto\SelfTest\Cipher
creating build\lib.win-amd64-cpython-310\Crypto\SelfTest\Hash
copying lib\Crypto\SelfTest\Hash\common.py -> build\lib.win-amd64-cpython-310\Crypto\SelfTest\Hash
copying lib\Crypto\SelfTest\Hash\test_HMAC.py -> build\lib.win-amd64-cpython-310\Crypto\SelfTest\Hash
copying lib\Crypto\SelfTest\Hash\test_MD2.py -> build\lib.win-amd64-cpython-310\Crypto\SelfTest\Hash
copying lib\Crypto\SelfTest\Hash\test_MD4.py -> build\lib.win-amd64-cpython-310\Crypto\SelfTest\Hash
copying lib\Crypto\SelfTest\Hash\test_MD5.py -> build\lib.win-amd64-cpython-310\Crypto\SelfTest\Hash
copying lib\Crypto\SelfTest\Hash\test_RIPEMD.py -> build\lib.win-amd64-cpython-310\Crypto\SelfTest\Hash
copying lib\Crypto\SelfTest\Hash\test_SHA.py -> build\lib.win-amd64-cpython-310\Crypto\SelfTest\Hash
copying lib\Crypto\SelfTest\Hash\test_SHA224.py -> build\lib.win-amd64-cpython-310\Crypto\SelfTest\Hash
copying lib\Crypto\SelfTest\Hash\test_SHA256.py -> build\lib.win-amd64-cpython-310\Crypto\SelfTest\Hash
copying lib\Crypto\SelfTest\Hash\test_SHA384.py -> build\lib.win-amd64-cpython-310\Crypto\SelfTest\Hash
copying lib\Crypto\SelfTest\Hash\test_SHA512.py -> build\lib.win-amd64-cpython-310\Crypto\SelfTest\Hash
copying lib\Crypto\SelfTest\Hash\__init__.py -> build\lib.win-amd64-cpython-310\Crypto\SelfTest\Hash
creating build\lib.win-amd64-cpython-310\Crypto\SelfTest\Protocol
copying lib\Crypto\SelfTest\Protocol\test_AllOrNothing.py -> build\lib.win-amd64-cpython-310\Crypto\SelfTest\Protocol
copying lib\Crypto\SelfTest\Protocol\test_chaffing.py -> build\lib.win-amd64-cpython-310\Crypto\SelfTest\Protocol
copying lib\Crypto\SelfTest\Protocol\test_KDF.py -> build\lib.win-amd64-cpython-310\Crypto\SelfTest\Protocol
copying lib\Crypto\SelfTest\Protocol\test_rfc1751.py -> build\lib.win-amd64-cpython-310\Crypto\SelfTest\Protocol
copying lib\Crypto\SelfTest\Protocol\__init__.py -> build\lib.win-amd64-cpython-310\Crypto\SelfTest\Protocol
creating build\lib.win-amd64-cpython-310\Crypto\SelfTest\PublicKey
copying lib\Crypto\SelfTest\PublicKey\test_DSA.py -> build\lib.win-amd64-cpython-310\Crypto\SelfTest\PublicKey
copying lib\Crypto\SelfTest\PublicKey\test_ElGamal.py -> build\lib.win-amd64-cpython-310\Crypto\SelfTest\PublicKey
copying lib\Crypto\SelfTest\PublicKey\test_importKey.py -> build\lib.win-amd64-cpython-310\Crypto\SelfTest\PublicKey
copying lib\Crypto\SelfTest\PublicKey\test_RSA.py -> build\lib.win-amd64-cpython-310\Crypto\SelfTest\PublicKey
copying lib\Crypto\SelfTest\PublicKey\__init__.py -> build\lib.win-amd64-cpython-310\Crypto\SelfTest\PublicKey
creating build\lib.win-amd64-cpython-310\Crypto\SelfTest\Random
copying lib\Crypto\SelfTest\Random\test_random.py -> build\lib.win-amd64-cpython-310\Crypto\SelfTest\Random
copying lib\Crypto\SelfTest\Random\test_rpoolcompat.py -> build\lib.win-amd64-cpython-310\Crypto\SelfTest\Random
copying lib\Crypto\SelfTest\Random\test__UserFriendlyRNG.py -> build\lib.win-amd64-cpython-310\Crypto\SelfTest\Random
copying lib\Crypto\SelfTest\Random\__init__.py -> build\lib.win-amd64-cpython-310\Crypto\SelfTest\Random
creating build\lib.win-amd64-cpython-310\Crypto\SelfTest\Random\Fortuna
copying lib\Crypto\SelfTest\Random\Fortuna\test_FortunaAccumulator.py -> build\lib.win-amd64-cpython-310\Crypto\SelfTest\Random\Fortuna
copying lib\Crypto\SelfTest\Random\Fortuna\test_FortunaGenerator.py -> build\lib.win-amd64-cpython-310\Crypto\SelfTest\Random\Fortuna
copying lib\Crypto\SelfTest\Random\Fortuna\test_SHAd256.py -> build\lib.win-amd64-cpython-310\Crypto\SelfTest\Random\Fortuna
copying lib\Crypto\SelfTest\Random\Fortuna\__init__.py -> build\lib.win-amd64-cpython-310\Crypto\SelfTest\Random\Fortuna
creating build\lib.win-amd64-cpython-310\Crypto\SelfTest\Random\OSRNG
copying lib\Crypto\SelfTest\Random\OSRNG\test_fallback.py -> build\lib.win-amd64-cpython-310\Crypto\SelfTest\Random\OSRNG
copying lib\Crypto\SelfTest\Random\OSRNG\test_generic.py -> build\lib.win-amd64-cpython-310\Crypto\SelfTest\Random\OSRNG
copying lib\Crypto\SelfTest\Random\OSRNG\test_nt.py -> build\lib.win-amd64-cpython-310\Crypto\SelfTest\Random\OSRNG
copying lib\Crypto\SelfTest\Random\OSRNG\test_posix.py -> build\lib.win-amd64-cpython-310\Crypto\SelfTest\Random\OSRNG
copying lib\Crypto\SelfTest\Random\OSRNG\test_winrandom.py -> build\lib.win-amd64-cpython-310\Crypto\SelfTest\Random\OSRNG
copying lib\Crypto\SelfTest\Random\OSRNG\__init__.py -> build\lib.win-amd64-cpython-310\Crypto\SelfTest\Random\OSRNG
creating build\lib.win-amd64-cpython-310\Crypto\SelfTest\Util
copying lib\Crypto\SelfTest\Util\test_asn1.py -> build\lib.win-amd64-cpython-310\Crypto\SelfTest\Util
copying lib\Crypto\SelfTest\Util\test_Counter.py -> build\lib.win-amd64-cpython-310\Crypto\SelfTest\Util
copying lib\Crypto\SelfTest\Util\test_number.py -> build\lib.win-amd64-cpython-310\Crypto\SelfTest\Util
copying lib\Crypto\SelfTest\Util\test_winrandom.py -> build\lib.win-amd64-cpython-310\Crypto\SelfTest\Util
copying lib\Crypto\SelfTest\Util\__init__.py -> build\lib.win-amd64-cpython-310\Crypto\SelfTest\Util
creating build\lib.win-amd64-cpython-310\Crypto\SelfTest\Signature
copying lib\Crypto\SelfTest\Signature\test_pkcs1_15.py -> build\lib.win-amd64-cpython-310\Crypto\SelfTest\Signature
copying lib\Crypto\SelfTest\Signature\test_pkcs1_pss.py -> build\lib.win-amd64-cpython-310\Crypto\SelfTest\Signature
copying lib\Crypto\SelfTest\Signature\__init__.py -> build\lib.win-amd64-cpython-310\Crypto\SelfTest\Signature
creating build\lib.win-amd64-cpython-310\Crypto\Protocol
copying lib\Crypto\Protocol\AllOrNothing.py -> build\lib.win-amd64-cpython-310\Crypto\Protocol
copying lib\Crypto\Protocol\Chaffing.py -> build\lib.win-amd64-cpython-310\Crypto\Protocol
copying lib\Crypto\Protocol\KDF.py -> build\lib.win-amd64-cpython-310\Crypto\Protocol
copying lib\Crypto\Protocol\__init__.py -> build\lib.win-amd64-cpython-310\Crypto\Protocol
creating build\lib.win-amd64-cpython-310\Crypto\PublicKey
copying lib\Crypto\PublicKey\DSA.py -> build\lib.win-amd64-cpython-310\Crypto\PublicKey
copying lib\Crypto\PublicKey\ElGamal.py -> build\lib.win-amd64-cpython-310\Crypto\PublicKey
copying lib\Crypto\PublicKey\pubkey.py -> build\lib.win-amd64-cpython-310\Crypto\PublicKey
copying lib\Crypto\PublicKey\RSA.py -> build\lib.win-amd64-cpython-310\Crypto\PublicKey
copying lib\Crypto\PublicKey\_DSA.py -> build\lib.win-amd64-cpython-310\Crypto\PublicKey
copying lib\Crypto\PublicKey\_RSA.py -> build\lib.win-amd64-cpython-310\Crypto\PublicKey
copying lib\Crypto\PublicKey\_slowmath.py -> build\lib.win-amd64-cpython-310\Crypto\PublicKey
copying lib\Crypto\PublicKey\__init__.py -> build\lib.win-amd64-cpython-310\Crypto\PublicKey
creating build\lib.win-amd64-cpython-310\Crypto\Signature
copying lib\Crypto\Signature\PKCS1_PSS.py -> build\lib.win-amd64-cpython-310\Crypto\Signature
copying lib\Crypto\Signature\PKCS1_v1_5.py -> build\lib.win-amd64-cpython-310\Crypto\Signature
copying lib\Crypto\Signature\__init__.py -> build\lib.win-amd64-cpython-310\Crypto\Signature
running build_ext
warning: GMP or MPIR library not found; Not building Crypto.PublicKey._fastmath.
building 'Crypto.Random.OSRNG.winrandom' extension
creating build\temp.win-amd64-cpython-310
creating build\temp.win-amd64-cpython-310\Release
creating build\temp.win-amd64-cpython-310\Release\src
"C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Tools\MSVC\14.16.27023\bin\HostX86\x64\cl.exe" /c /nologo /O2 /W3 /GL /DNDEBUG /MD -Isrc/ -Isrc/inc-msvc/ -IC:\Users\renzo\AppData\Local\Programs\Thonny\include -IC:\Users\renzo\AppData\Local\Programs\Thonny\Include "-IC:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Tools\MSVC\14.16.27023\include" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\winrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\cppwinrt" /Tcsrc/winrand.c /Fobuild\temp.win-amd64-cpython-310\Release\src/winrand.obj
winrand.c
C:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\ucrt\inttypes.h(27): error C2061: errore di sintassi: identificatore 'intmax_t'
C:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\ucrt\inttypes.h(28): error C2061: errore di sintassi: identificatore 'rem'
C:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\ucrt\inttypes.h(28): error C2059: errore di sintassi: ';'
C:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\ucrt\inttypes.h(29): error C2059: errore di sintassi: '}'
C:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\ucrt\inttypes.h(31): error C2061: errore di sintassi: identificatore 'imaxdiv_t'
C:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\ucrt\inttypes.h(31): error C2059: errore di sintassi: ';'
C:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\ucrt\inttypes.h(41): error C2143: errore di sintassi: '{' mancante prima di '__cdecl'
C:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\ucrt\inttypes.h(42): error C2146: errore di sintassi: ')' mancante prima dell'identificatore '_Number'
C:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\ucrt\inttypes.h(42): error C2061: errore di sintassi: identificatore '_Number'
C:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\ucrt\inttypes.h(42): error C2059: errore di sintassi: ';'
C:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\ucrt\inttypes.h(43): error C2059: errore di sintassi: ')'
C:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\ucrt\inttypes.h(46): error C2143: errore di sintassi: '{' mancante prima di '__cdecl'
C:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\ucrt\inttypes.h(47): error C2146: errore di sintassi: ')' mancante prima dell'identificatore '_Numerator'
C:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\ucrt\inttypes.h(47): error C2061: errore di sintassi: identificatore '_Numerator'
C:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\ucrt\inttypes.h(47): error C2059: errore di sintassi: ';'
C:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\ucrt\inttypes.h(47): error C2059: errore di sintassi: ','
C:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\ucrt\inttypes.h(49): error C2059: errore di sintassi: ')'
C:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\ucrt\inttypes.h(51): error C2143: errore di sintassi: '{' mancante prima di '__cdecl'
C:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\ucrt\inttypes.h(57): error C2143: errore di sintassi: '{' mancante prima di '__cdecl'
C:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\ucrt\inttypes.h(64): error C2143: errore di sintassi: '{' mancante prima di '__cdecl'
C:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\ucrt\inttypes.h(70): error C2143: errore di sintassi: '{' mancante prima di '__cdecl'
C:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\ucrt\inttypes.h(77): error C2143: errore di sintassi: '{' mancante prima di '__cdecl'
C:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\ucrt\inttypes.h(83): error C2143: errore di sintassi: '{' mancante prima di '__cdecl'
C:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\ucrt\inttypes.h(90): error C2143: errore di sintassi: '{' mancante prima di '__cdecl'
C:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\ucrt\inttypes.h(96): error C2143: errore di sintassi: '{' mancante prima di '__cdecl'
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\BuildTools\\VC\\Tools\\MSVC\\14.16.27023\\bin\\HostX86\\x64\\cl.exe' failed with exit code 2
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: legacy-install-failure
× Encountered error while trying to install package.
╰─> pycrypto
note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure.
Process returned with code 1
Risoluzione del problema di installazione del pacchetto machine/pycrypt
Una soluzione a questo problema è la seguente:
Dal log, puoi ottenere il percorso di Microsoft Visual Studio BuildTools, e poi eseguire questi comandi:
cd "C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Auxiliary\Build"
vcvarsall.bat x86_amd64
cd %VCINSTALLDIR%
for /R %f in (*stdint.h) do set CL=-FI"%f"
Ottieni la cartella di installazione da Strumenti --> Apri la cartella del programma Thonny...
poi vai alla cartella degli script:
cd C:\Users\renzo\AppData\Local\Programs\Thonny\Scripts
Poi riprova ad installare il pacchetto machine
.
Microsoft Windows [Version 10.0.19045.2604]
(c) Microsoft Corporation. All rights reserved.
C:\Users\renzo\AppData\Local\Programs\Thonny\Scripts>cd "C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Auxiliary\Build"
C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Auxiliary\Build>vcvarsall.bat x86_amd64
**********************************************************************
** Visual Studio 2017 Developer Command Prompt v15.0
** Copyright (c) 2017 Microsoft Corporation
**********************************************************************
[vcvarsall.bat] Ambiente inizializzato per: 'x86_x64'
C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Auxiliary\Build>cd %VCINSTALLDIR%
C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC>for /R %f in (*stdint.h) do set CL=-FI"%f"
C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC>set CL=-FI"C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Tools\MSVC\14.16.27023\include\stdint.h"
C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC>cd C:\Users\renzo\AppData\Local\Programs\Thonny\Scripts
C:\Users\renzo\AppData\Local\Programs\Thonny\Scripts>pip install machine
Collecting machine
Using cached machine-0.0.1-py2.py3-none-any.whl (4.2 kB)
Collecting pycrypto
Using cached pycrypto-2.6.1.tar.gz (446 kB)
Preparing metadata (setup.py) ... done
Building wheels for collected packages: pycrypto
Building wheel for pycrypto (setup.py) ... done
Created wheel for pycrypto: filename=pycrypto-2.6.1-cp310-cp310-win_amd64.whl size=518524 sha256=fa3f3ff0eca2465a42ea648cc7381ac5246ef22ec38cf3d0c4a9a0289ad43603
Stored in directory: c:\users\renzo\appdata\local\pip\cache\wheels\a0\d7\84\7efd0ece2c2dd3cb2cca129cbc772eaf7c898f604e9d040b7b
Successfully built pycrypto
Installing collected packages: pycrypto, machine
WARNING: The script sample.exe is installed in 'C:\Users\renzo\AppData\Local\Programs\Thonny\Scripts' which is not on PATH.
Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
Successfully installed machine-0.0.1 pycrypto-2.6.1
[notice] Una nuova versione di pip disponibile: 22.3.1 -> 23.0.1
[notice] Per aggiornare, eseguire: C:\Users\renzo\AppData\Local\Programs\Thonny\python.exe -m pip install --upgrade pip
C:\Users\renzo\AppData\Local\Programs\Thonny\Scripts>
Ora riproviamo l’esecuzione dello sketch di blink. E finalmente, funziona.
Ecco l’esp8266.
Grazie
Padroneggiare la programmazione dell’esp8266 con MicroPython
- MicroPython con esp8266 ed esp32: installazione del firmware e utilizzo di strumenti standard
- MicroPython con esp8266 ed esp32: installazione del firmware e utilizzo dell’IDE Thonny
- MicroPython con esp8266 ed esp32: installazione del firmware e utilizzo dell’IDE PyCharm
Padroneggiare la programmazione dell’esp32 con MicroPython
- MicroPython con esp8266 ed esp32: installazione del firmware e utilizzo di strumenti standard
- MicroPython con esp8266 ed esp32: installazione del firmware e utilizzo dell’IDE Thonny
- MicroPython con esp8266 ed esp32: installazione del firmware e utilizzo dell’IDE PyCharm