2
votes

I have 2 Python environments (Python 3.6 by Visual studio 2017 and Python 3.7 by Anaconda)

When I run a script I get an error that import numpy

Traceback (most recent call last): File "C:\ProgramData\Anaconda3\lib\site-packages\numpy\core__init__.py", line 16, in from . import multiarray ImportError: DLL load failed: The specified module could not be found.

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "D:\projects\UdacityNanoDegreeCourse\UdacityNanoDegreeCourse\LearningCurves\LearningCurves.py", line 2, in import numpy as np File "C:\ProgramData\Anaconda3\lib\site-packages\numpy__init__.py", line 142, in from . import add_newdocs File "C:\ProgramData\Anaconda3\lib\site-packages\numpy\add_newdocs.py", line 13, in from numpy.lib import add_newdoc File "C:\ProgramData\Anaconda3\lib\site-packages\numpy\lib__init__.py", line 8, in from .type_check import * File "C:\ProgramData\Anaconda3\lib\site-packages\numpy\lib\type_check.py", line 11, in import numpy.core.numeric as _nx File "C:\ProgramData\Anaconda3\lib\site-packages\numpy\core__init__.py", line 26, in 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: The specified module could not be found.

As a temporary fix I run Visual Studio from Anaconda prompt.

How can I fix the environment so that I could run Visual Studio as usually by double click? Do I need to change PATH somehow?

Right click-> Activate Environment didn't help either.

1

1 Answers

0
votes

Resolved it myself

In the PATH variable

C:\ProgramData\Anaconda3 C:\ProgramData\Anaconda3\Library\mingw-w64\bin C:\ProgramData\Anaconda3\Library\usr\bin C:\ProgramData\Anaconda3\Library\bin C:\ProgramData\Anaconda3\Scripts

should go first