Closed zyforcode closed 3 years ago
Did you try the troubleshooting tips at the link provided in your traceback? https://numpy.org/devdocs/user/troubleshooting-importerror.html It includes VSCode notes.
Is your problem limited to VSCode? Can you import OSMnx with a standard python interpreter from your command prompt:
conda activate ox
python -c "import osmnx; print(osmnx.__version__)"
m
Yes, I tried that tips and I chose the right python interpreter. I have installed multiple versions of Python, here are my python versions: I can import import OSMnx with a standard python interpreter from my command prompt, like this: I think this problem is only limited to VSCode, I can import OSMnx with PyCharm Community Edition 2020.2, and I can import OSMnx with the jupyter notebook extension of VSCode. So I'm not sure what the real problem is.
If you're able to import OSMnx in the python interpreter, PyCharm, and the Jupyter notebook extension for VSCode, it sounds like OSMnx is installed properly on your system. Sounds like a VSCode configuration issue. I don't use VSCode so I'm afraid I don't have any further advice.
Ok. Thanks a lot。
Issue: I have installed the OSMNX according to documentation on readthedocs, but I can't import osmnx when I using VS Code, here is the issues:
Traceback (most recent call last): File "D:\ProgramFilesTS\Anaconda3\envs\ox\lib\site-packages\numpy\core__init__.py", line 22, in
from . import overrides
File "D:\ProgramFilesTS\Anaconda3\envs\ox\lib\site-packages\numpy\core\overrides.py", line 7, in
from . import multiarray File "D:\ProgramFilesTS\Anaconda3\envs\ox\lib\site-packages\numpy\core\multiarray.py", line 12, in
from numpy.core._multiarray_umath import ( ImportError: DLL load failed while importing _multiarray_umath: 找不到指定的模块。
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "e:\VS Code WorkSpace\osmnx-examples\myfiles\learn_osmnx.py", line 2, in
import osmnx as ox
File "D:\ProgramFilesTS\Anaconda3\envs\ox\lib\site-packages\osmnx__init.py", line 3, in
from ._api import *
File "D:\ProgramFilesTS\Anaconda3\envs\ox\lib\site-packages\osmnx_api.py", line 3, in
from .bearing import add_edge_bearings
File "D:\ProgramFilesTS\Anaconda3\envs\ox\lib\site-packages\osmnx\bearing.py", line 5, in
import numpy as np
File "D:\ProgramFilesTS\Anaconda3\envs\ox\lib\site-packages\numpy\ init.py", line 140, in
from . import core
File "D:\ProgramFilesTS\Anaconda3\envs\ox\lib\site-packages\numpy\core\ init__.py", line 48, in
raise ImportError(msg)
ImportError:
IMPORTANT: PLEASE READ THIS FOR ADVICE ON HOW TO SOLVE THIS ISSUE!
Importing the numpy C-extensions failed. This error can happen for many reasons, often due to issues with your setup or how NumPy was installed.
We have compiled some common reasons and troubleshooting tips at:
Please note and check the following:
and make sure that they are the versions you expect. Please carefully study the documentation linked above for further help.
Original error was: DLL load failed while importing _multiarray_umath: 找不到指定的模块。
Environment (
conda list
):Details about
conda
and system (conda info
):