我正在使用AWS(ubuntu服务器18.04)。 当我尝试使用“ import numpy”运行代码时,出现错误:
Traceback (most recent call last):
File "main.py", line 1, in <module>
import pandas as pd
File "/usr/lib/python3/dist-packages/pandas/__init__.py", line 19, in <module>
"Missing required dependencies {0}".format(missing_dependencies))
ImportError: Missing required dependencies ['numpy']
Error in sys.excepthook:
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/apport_python_hook.py", line 63, in apport_excepthook
from apport.fileutils import likely_packaged, get_recent_crashes
File "/usr/lib/python3/dist-packages/apport/__init__.py", line 5, in <module>
from apport.report import Report
File "/usr/lib/python3/dist-packages/apport/report.py", line 30, in <module>
import apport.fileutils
File "/usr/lib/python3/dist-packages/apport/fileutils.py", line 23, in <module>
from apport.packaging_impl import impl as packaging
File "/usr/lib/python3/dist-packages/apport/packaging_impl.py", line 24, in <module>
import apt
File "/usr/lib/python3/dist-packages/apt/__init__.py", line 23, in <module>
import apt_pkg
ModuleNotFoundError: No module named 'apt_pkg'
Original exception was:
Traceback (most recent call last):
File "main.py", line 1, in <module>
import pandas as pd
File "/usr/lib/python3/dist-packages/pandas/__init__.py", line 19, in <module>
"Missing required dependencies {0}".format(missing_dependencies))
ImportError: Missing required dependencies ['numpy']
我尝试重新安装所有库,并已经做好所有建议,分别是here和here:
sudo -H python3.7 -m pip uninstall numpy
sudo -H python3.7 -m pip uninstall pandas
sudo -H python3.7 -m pip install numpy
sudo -H python3.7 -m pip install pandas
sudo -H python3.7 -m pip install --upgrade numpy
sudo -H python3.7 -m pip install --upgrade pandas
sudo apt-get install libatlas-base-dev
注意:做sudo -H python3.7 -m pip install numpy==10.14.0
时会出错。
请告诉其他在这种情况下有什么帮助?