When we are coding python code, we typically use packages and modules that we import. For example, when we are coding we may write:
import numpy
import requests
from bs4 import BeautifulSoup
When we are trying to integrate python with html with Pyscript (https://pyscript.net/), it just says that it doesn’t have the package installed. However, when this happens in normal python we use PiP and import it from there. However, what should we do when we need a package in Pyscript?
Thank you!
At this time, bs4 is not supported. You will receive an error
You will also have problems using the requests package in pyscript. Use
pyfetch
instead ofrequests.get
.To import numpy and requests, use
<py-env>
before<py-script>
. Example:Pyscript also supports package versions: