Conda environment can't find lxml

已回答

I am baffled by the failure of Pycharm in a Conda environment to recognize lxml. I have several versions on my Mac OS 10.14 I downloaded the Conda distribution, which installed itself at /users/martin/anaconda3. If I call up python froma terminal it defaults to that version of Python. I have a Python script that uses lxml. If I run the script from the command line in my home directory ( e.g python /users/martin/a.py it executes properly. I created a Conda environment at /users/martin/dropbox/condapycharmtrial. I checked the Python interpreter, which is python3.7 and in the Pycharm environment shows the Anaconda icon. So I assume that the interpreter is set properly. But when I run the script a.py as part of that project I get the message "ModuleNotFoundError: No module named 'lxml" So the "import lxml" statement works from the command line, but it does not work from within Pycharm, even though the interpreter declares itself to be the same that works when I call it from the command line. So what appears to be same installation of Python 3.7 knows where to find lxml in one environment but not in the other. What am I doing wrong?

1
Avatar
Permanently deleted user

Same issue for me on Windows 7.

ModuleNotFoundError: No module named 'lxml'

other imports (e.g. socket, sys, os etc) all working fine

0

lxml is not a part of the standard library, make sure it is present in the list of packages in Settings | Project ... | Project Interpreter and if it is not - install it.

0

请先登录再写评论。