The main reason Spyder can't find 'lxml' is I used standalone Spyder, in order to fix this, I have to use a separate environment.
1 - Follow below article to create a new virtual environment https://packaging.python.org/en/latest/guides/installing-using-pip-and-virtual-environments/#creating-a-virtual-environment
2 - Follow below article to install necessary packages in the new environment, which link to Spyder IDE later, all issues will be fixed. https://github.com/spyder-ide/spyder/wiki/Working-with-packages-and-environments-in-Spyder#installing-packages-into-the-same-environment-as-spyder
Your development environment may be using a different Python installation. Run python -c "import lxml"
in the same shell where you ran pip install ...
. If that works, then configure your development environment (there is an FAQ link on your screenshot).
It may also happen that pip
and python
belong to different Python installations. To fix it, use python -m pip install ...
instead of pip install ...
.
For example, if you run python -m pip install lxml
, that should install lxml , then running python -c "import lxml; print('OK')"
should display OK .
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.