我試圖安裝一個名爲模塊tushare,我已經試過3種方法:畫中畫,easy_install的和的setup.py安裝,它們都具有相同的錯誤:Python模塊安裝錯誤
ImportError: No module named 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安裝
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
我能做的未來?
在安裝lxml時或者在安裝lxml之後嘗試安裝tushare時,是否收到有關libxml2和libxslt的錯誤? – Steampunkery
從[here](http://www.lfd.uci.edu/~gohlke/pythonlibs/#lxml)獲取lxml,然後將文件屬性從.zip更改爲.whl。 .C:\ WINDOWS \ system32> cd C:\ Python27 \ Scripts ___________________ C:\ Python27 \ Scripts> pip.exe安裝C:\ Users \ Endeavour \ Desktop \ lxml-3.6.4-cp27-cp27m-win_amd64 .whl 處理C:\用戶\努力\桌面\ LXML-3.6.4-cp27-cp27m-win_amd64.whl 安裝收集包:LXML 成功安裝LXML-3.6.4 ' – hyppos
所以它的工作?如果有效,請接受答案。 – Steampunkery