Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.1k views
in Technique[技术] by (71.8m points)

python - Numpy - ImportError: cannot import name shares_memory

I'm going to preface this by saying that I'm relatively new to Python and so please forgive me if I have difficulty understanding something.

I've recently been trying to install OpenCV on my computer following the "Installing OpenCV from prebuilt binaries" instructions found here:

http://docs.opencv.org/3.1.0/d5/de5/tutorial_py_setup_in_windows.html#gsc.tab=0

I initially tried to install OpenCV by itself, as I already had Python 3.5 and a working version of numpy. However, my attempts to import cv2 failed, and I eventually decided to uninstall Python and follow all the steps listed on the website. However, I now have this error when I try import numpy:

Traceback (most recent call last):
  File "C:/PythonProgramming/SLIC/src/SLICAlgorithm.py", line 1, in <module>
    import numpy
  File "C:Python27libsite-packages
umpy\__init__.py", line 180, in <module>
    from . import add_newdocs
  File "C:Python27libsite-packages
umpyadd_newdocs.py", line 13, in <module>
    from numpy.lib import add_newdoc
  File "C:Python27libsite-packages
umpylib\__init__.py", line 4, in <module>
    from type_check import *
  File "C:Python27libsite-packages
umpylibype_check.py", line 8, in <module>
    import numpy.core.numeric as _nx
  File "C:Python27libsite-packages
umpycore\__init__.py", line 20, in <module>
    import function_base
  File "C:Python27libsite-packages
umpycorefunction_base.py", line 6, in <module>
    from .numeric import result_type, NaN, shares_memory, MAY_SHARE_BOUNDS, TooHardError
ImportError: cannot import name shares_memory

Process finished with exit code 1

Other people online seem to have no problem with these instructions, or at least not with numpy. What does this error mean, and what can I do to fix it? I have a 64-bit version of Windows 10 and am working in PyCharm. All help you can provide would be much appreciated.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

same problem, the following fix worked for me

pip install -I numpy --force-reinstall

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...