简体   繁体   中英

Ubuntu Import Error: No module named -— despite having been installed. Could there be a user permission issue or similar

I am trying to import lxml, html2text, oursql etc.However despite having pip installed all of these I see an error log that looks like this. I feel there could be some permission issues or something fundamental I don't understand. I am using python 2.7 with ubuntu 16.04. I am using pycharm as the IDE to run the scripts.

/home/Desktop/SOURCE_CODE/venv/bin/python
/home//Desktop/SOURCE_CODE/notice_parser/parse_mails
Traceback (most recent call last):
File "/home/Desktop/SOURCE_CODE/notice_parser/parse_mails", line 8, in <module>
from modules.config import log
File "/home/Desktop/SOURCE_CODE/notice_parser/modules/config.py", line 5, in <module>
import lxml
ImportError: No module named lxml

Process finished with exit code 1

By running sudo apt-get install libxml2-dev libxslt-dev python-dev it should solve your problem for more information: https://lxml.de/installation.html

Best regards

Probably permissions issue. Try running pip install --user [package]

Try This:

pip3 install lxml
sudo apt-get install libxml2-dev libxslt-dev python-dev
pip install --user lxml

if it don't work you need to download anaconda is aslo python but it has builtin library like pandas , jupiter-notebook , ipython , 'numpy' ,' lxml ' and others that used for data analysis

you can download here!

https://www.anaconda.com/

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM