V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
推荐学习书目
Learn Python the Hard Way
Python Sites
PyPI - Python Package Index
http://diveintopython.org/toc/index.html
Pocoo
值得关注的项目
PyPy
Celery
Jinja2
Read the Docs
gevent
pyenv
virtualenv
Stackless Python
Beautiful Soup
结巴中文分词
Green Unicorn
Sentry
Shovel
Pyflakes
pytest
Python 编程
pep8 Checker
Styles
PEP 8
Google Python Style Guide
Code Style from The Hitchhiker's Guide
yeyu1989
V2EX  ›  Python

请教一下两个报错,在 import 库的时候

  •  
  •   yeyu1989 · 2017-08-02 16:39:40 +08:00 · 7080 次点击
    这是一个创建于 2700 天前的主题,其中的信息可能已经有所发展或是发生改变。
    错误 1:import tushare 出错
    C:\Windows\system32>python
    Python 3.6.0a4 (v3.6.0a4:017cf260936b, Aug 16 2016, 00:45:10) [MSC v.1900 32 bit
    (Intel)] on win32
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import tushare
    Traceback (most recent call last):
    File "<stdin>", line 1, in <module>
    File "C:\Users\zhangjw\AppData\Local\Programs\Python\Python36-32\lib\site-pack
    ages\tushare\__init__.py", line 6, in <module>
    from tushare.stock.trading import (get_hist_data, get_tick_data,
    File "C:\Users\zhangjw\AppData\Local\Programs\Python\Python36-32\lib\site-pack
    ages\tushare\stock\trading.py", line 13, in <module>
    import lxml.html
    File "C:\Users\zhangjw\AppData\Local\Programs\Python\Python36-32\lib\site-pack
    ages\lxml\html\__init__.py", line 54, in <module>
    from .. import etree
    ImportError: DLL load failed: 找不到指定的程序。


    错误 2:import numpy 出错
    C:\Windows\system32>pip install numpy
    Requirement already satisfied: numpy in c:\users\zhangjw\appdata\local\programs\
    python\python36-32\lib\site-packages


    >>> import numpy
    Traceback (most recent call last):
    File "C:\Users\zhangjw\AppData\Local\Programs\Python\Python36-32\lib\site-pack
    ages\numpy\core\__init__.py", line 16, in <module>
    from . import multiarray
    ImportError: DLL load failed: 找不到指定的程序。

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):
    File "<stdin>", line 1, in <module>
    File "C:\Users\zhangjw\AppData\Local\Programs\Python\Python36-32\lib\site-pack
    ages\numpy\__init__.py", line 142, in <module>
    from . import add_newdocs
    File "C:\Users\zhangjw\AppData\Local\Programs\Python\Python36-32\lib\site-pack
    ages\numpy\add_newdocs.py", line 13, in <module>
    from numpy.lib import add_newdoc
    File "C:\Users\zhangjw\AppData\Local\Programs\Python\Python36-32\lib\site-pack
    ages\numpy\lib\__init__.py", line 8, in <module>
    from .type_check import *
    File "C:\Users\zhangjw\AppData\Local\Programs\Python\Python36-32\lib\site-pack
    ages\numpy\lib\type_check.py", line 11, in <module>
    import numpy.core.numeric as _nx
    File "C:\Users\zhangjw\AppData\Local\Programs\Python\Python36-32\lib\site-pack
    ages\numpy\core\__init__.py", line 26, in <module>
    raise ImportError(msg)
    ImportError:
    Importing the multiarray numpy extension module failed. Most
    likely you are trying to import a failed build of numpy.
    If you're working with a numpy git repo, try `git clean -xdf` (removes all
    files not under version control). Otherwise reinstall numpy.

    Original error was: DLL load failed: 找不到指定的程序。


    >>> import pandas
    Traceback (most recent call last):
    File "<stdin>", line 1, in <module>
    File "C:\Users\zhangjw\AppData\Local\Programs\Python\Python36-32\lib\site-pack
    ages\pandas\__init__.py", line 19, in <module>
    "Missing required dependencies {0}".format(missing_dependencies))
    ImportError: Missing required dependencies ['numpy']
    >>> exit()
    4 条回复    2017-08-04 01:52:02 +08:00
    ipwx
        1
    ipwx  
       2017-08-02 16:49:32 +08:00
    一般碰到这种情况,我都会劝人用 Anaconda,省时又省力。

    而且楼主要用 NumPy 和 Pandas,就更适合用 Anaconda 了。
    ivechan
        2
    ivechan  
       2017-08-02 17:53:28 +08:00
    重装 Python, 然后重新 pip install numpy 试试?
    可以换 Python3.5 试试, 再不行就按照 #1 说的装 anaconda 吧, 不过 anaconda 国内下载速度一般.
    NoAnyLove
        3
    NoAnyLove  
       2017-08-02 22:22:04 +08:00
    其实我电脑系统上的 Python 3.5 就是直接用的官方安装包,然后用 pip 安装的 numpy,并没有发现任何问题
    wentian
        4
    wentian  
       2017-08-04 01:52:02 +08:00 via Android
    用 anaconda

    人生苦短,这种事情不应该花时间去解决
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   3267 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 24ms · UTC 12:13 · PVG 20:13 · LAX 04:13 · JFK 07:13
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.