I have Win7 SP1 on VirtualBox with Anaconda 5.2 + Python 3.6.5 32-bit installed. I get the following error when running this python code, and I still cannot pin point the root cause of the problem. Please help...
>> type test.py
import numpy as np
np.random.seed(42)
print(np.random.randint(1, 101, 100))
>> python test.py
Traceback (most recent call last):
File "C:\Users\JC\Anaconda3\lib\site-packages\numpy\core\__init__.py", line 16, in <module>
from . import multiarray
ImportError: DLL load failed: The specified path is invalid.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File ".\test.py", line 1, in <module>
import numpy as np
File "C:\Users\JC\Anaconda3\lib\site-packages\numpy\__init__.py", line 158, in <module>
from . import add_newdocs
File "C:\Users\JC\Anaconda3\lib\site-packages\numpy\add_newdocs.py", line 13, in <module>
from numpy.lib import add_newdoc
File "C:\Users\JC\Anaconda3\lib\site-packages\numpy\lib\__init__.py", line 8, in <module>
from .type_check import *
File "C:\Users\JC\Anaconda3\lib\site-packages\numpy\lib\type_check.py", line 11, in <module>
import numpy.core.numeric as _nx
File "C:\Users\JC\Anaconda3\lib\site-packages\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: The specified path is invalid.
I have installed Anaconda on C-drive, and store my python codes on J-drive.
run the code from C-drive
cmd.exe
from start menu python J:\\my_codes\\test.py
copy the code from J-drive to C-drive, and run on C-drive
C:\\my_codes\\test.py
cmd.exe
from start menu python C:\\my_codes\\test.py
run the code manually within the ipython
console on C-drive
cmd.exe
from start menu import numpy as np
also works fine run the code from J-drive
cmd.exe
from start menu cd J:\\my_codes
python test.py
ImportError
message run the code manually within the ipython
console on J-drive
cmd.exe
from start menu cd J:\\my_codes
import numpy as np
ImportError
message I do not have this issue before upgrading to Anaconda 5.2 on my VM. Any idea how to fix this issue? Thanks
Somehow I think fix this problem by reinstalling VirtualBox + Extension Pack, Anaconda 5.2 and Sublime Text3. I also make sure the Environment Path for ST3 was inserted after "Anaconda's Path"... Somehow this combo resolve the issue. Now I can move on...
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.