我尝试安装一个名为tushare的模块,我尝试了3种方法:pip,easy_install和setup.py install,它们都有相同的错误:
ImportError:没有名为lxml.html的模块
PIP:
C:\WINDOWS\system32>pip install tushare
Collecting tushare
Using cached tushare-0.6.8.tar.gz
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "c:\users\endeav~1\appdata\local\temp\pip-build-pkbgde\tushare\setup.py", line 4, in <module>
import tushare
File "tushare\__init__.py", line 6, in <module>
from tushare.stock.trading import (get_hist_data, get_tick_data,
File "tushare\stock\trading.py", line 13, in <module>
import lxml.html
ImportError: No module named lxml.html
easy_install的:
C:\WINDOWS\system32>easy_install tushare
Searching for tushare
Reading https://pypi.python.org/simple/tushare/
Downloading https://pypi.python.org/packages/0a/ca/ad9eeed1c285c58d115a0dd82734e5375abf1b6e510c7c24f2f8de921c75/tushare-0.6.8.tar.gz#md5=7626d97088d93d99c1a6ece80302d617
Best match: tushare 0.6.8
Processing tushare-0.6.8.tar.gz
Writing c:\users\endeav~1\appdata\local\temp\easy_install-iisas7\tushare-0.6.8\setup.cfg
Running tushare-0.6.8\setup.py -q bdist_egg --dist-dir c:\users\endeav~1\appdata\local\temp\easy_install-iisas7\tushare-0.6.8\egg-dist-tmp-dakavz
Traceback (most recent call last):
File "c:\python27\lib\runpy.py", line 174, in _run_module_as_main
"__main__", fname, loader, pkg_name)
.......
File "c:\users\endeav~1\appdata\local\temp\easy_install-iisas7\tushare-0.6.8\tushare\stock\trading.py", line 13, in <module>
ImportError: No module named lxml.html
setup.py install
C:\WINDOWS\system32>cd C:\Users\Endeavour\Desktop\tushare-0.6.8
C:\Users\Endeavour\Desktop\tushare-0.6.8>setup.py install
Traceback (most recent call last):
File "C:\Users\Endeavour\Desktop\tushare-0.6.8\setup.py", line 4, in <module>
import tushare
File "C:\Users\Endeavour\Desktop\tushare-0.6.8\tushare\__init__.py", line 6, in <module>
from tushare.stock.trading import (get_hist_data, get_tick_data,
File "C:\Users\Endeavour\Desktop\tushare-0.6.8\tushare\stock\trading.py", line 13, in <module>
import lxml.html
ModuleNotFoundError: No module named 'lxml'
我在Windows 10上安装了python 2.7和3.0,在IDLE上工作,没有IDE,我该如何解决?
然后我安装了lxml:
C:\WINDOWS\system32>pip install lxml
错误:
** make sure the development packages of libxml2 and libxslt are installed **
Could not find function xmlCheckVersion in library libxml2. Is libxml2 installed?
我无法使用pip来安装libxml2和libxslt。
C:\WINDOWS\system32>pip install libxml2
Collecting libxml2
Could not find a version that satisfies the requirement libxml2 (from versions: )
No matching distribution found for libxml2
C:\WINDOWS\system32>pip install libxslt
Collecting libxslt
Could not find a version that satisfies the requirement libxslt (from versions: )
No matching distribution found for libxslt
接下来我该怎么办?
答案 0 :(得分:0)
您是否尝试过安装lxml
?似乎所有追溯都指向没有名为lxml
的模块。尝试输入您的终端提示:pip install lxml
。 lxml
为我安装完美。
编辑:
看起来pip中没有libxml2。我发现了另一个stackoverflow question。看起来他们遇到了同样的问题。最好的部分是:如果你按照prebuilt binaries链接(我在这里方便地链接到你),有libxml2和libsxlt捆绑在一起的lxml下载!