我正在使用 anaconda 作为我的代码的环境管理器。当我安装 anaconda 并创建环境时,一切正常。但是当我第二天回来并激活环境时,我不断收到ModuleNotFoundError
C:\Users\Username\tutorial>activate raman_37
(raman_37) C:\Users\Username\tutorial>conda list
# packages in environment at C:\Users\Username\.conda\envs\raman_37:
#
# Name Version Build Channel
_tflow_select 2.2.0 eigen
absl-py 0.9.0 py37_0
astor 0.8.0 py37_0
blas 1.0 mkl
blinker 1.4 py37_0
ca-certificates 2020.1.1 0
cachetools 3.1.1 py_0
certifi 2020.4.5.1 py37_0
cffi 1.14.0 py37h7a1dbc1_0
chardet 3.0.4 py37_1003
click 7.1.2 py_0
configparser 5.0.0 pypi_0 pypi
cryptography 2.9.2 py37h7a1dbc1_0
docker-pycreds 0.4.0 pypi_0 pypi
freetype 2.9.1 ha9979f8_1
gast 0.2.2 py37_0
gitdb 4.0.5 pypi_0 pypi
gitpython 3.1.2 pypi_0 pypi
google-auth 1.14.1 py_0
google-auth-oauthlib 0.4.1 py_2
google-pasta 0.2.0 py_0
gql 0.2.0 pypi_0 pypi
graphql-core 1.1 pypi_0 pypi
grpcio 1.27.2 py37h351948d_0
h5py 2.10.0 py37h5e291fa_0
hdf5 1.10.4 h7ebc959_0
icc_rt 2019.0.0 h0cc432a_1
idna 2.9 py_1
intel-openmp 2020.1 216
joblib 0.14.1 py_0
jpeg 9b hb83a4c4_2
keras 2.3.1 0
keras-applications 1.0.8 py_0
keras-base 2.3.1 py37_0
keras-preprocessing 1.1.0 py_1
libpng 1.6.37 h2a8f88b_0
libprotobuf 3.11.4 h7bd577a_0
libtiff 4.1.0 h56a325e_0
markdown 3.1.1 py37_0
mkl 2020.1 216
mkl-service 2.3.0 py37hb782905_0
mkl_fft 1.0.15 py37h14836fe_0
mkl_random 1.1.0 py37h675688f_0
numpy 1.18.4 pypi_0 pypi
nvidia-ml-py3 7.352.0 pypi_0 pypi
oauthlib 3.1.0 py_0
olefile 0.46 py37_0
opencv-python 4.2.0.34 pypi_0 pypi
openssl 1.1.1g he774522_0
opt_einsum 3.1.0 py_0
pandas 1.0.3 py37h47e9c7a_0
pathtools 0.1.2 pypi_0 pypi
pillow 7.1.2 py37hcc1f983_0
pip 20.0.2 py37_3
promise 2.3 pypi_0 pypi
protobuf 3.11.4 py37h33f27b4_0
psutil 5.7.0 pypi_0 pypi
pyasn1 0.4.8 py_0
pyasn1-modules 0.2.7 py_0
pycparser 2.20 py_0
pyjwt 1.7.1 py37_0
pyopenssl 19.1.0 py37_0
pypiwin32 223 pypi_0 pypi
pyreadline 2.1 py37_1
pysocks 1.7.1 py37_0
python 3.7.7 h81c818b_4
python-dateutil 2.8.1 py_0
pytz 2020.1 py_0
pywin32 227 pypi_0 pypi
pyyaml 5.3.1 py37he774522_0
requests 2.23.0 py37_0
requests-oauthlib 1.3.0 py_0
rsa 4.0 py_0
scikit-learn 0.22.1 py37h6288b17_0
scipy 1.4.1 py37h9439919_0
sentry-sdk 0.14.4 pypi_0 pypi
setuptools 46.2.0 py37_0
shortuuid 1.0.1 pypi_0 pypi
six 1.14.0 py37_0
smmap 3.0.4 pypi_0 pypi
sqlite 3.31.1 h2a8f88b_1
subprocess32 3.5.4 pypi_0 pypi
tensorboard 2.1.0 py3_0
tensorflow 2.1.0 eigen_py37hd727fc0_0
tensorflow-base 2.1.0 eigen_py37h49b2757_0
tensorflow-estimator 2.1.0 pyhd54b08b_0
termcolor 1.1.0 py37_1
tk 8.6.8 hfa6e2cd_0
urllib3 1.25.8 py37_0
vc 14.1 h0510ff6_4
vs2015_runtime 14.16.27012 hf0eaf9b_1
wandb 0.8.36 pypi_0 pypi
watchdog 0.10.2 pypi_0 pypi
werkzeug 0.14.1 py37_0
wheel 0.34.2 py37_0
win_inet_pton 1.1.0 py37_0
wincertstore 0.2 py37_0
wrapt 1.12.1 py37he774522_1
xz 5.2.5 h62dcd97_0
yaml 0.1.7 hc54c509_2
zlib 1.2.11 h62dcd97_4
zstd 1.3.7 h508b16e_0
(raman_37) C:\Users\Username\tutorial>tutorial.py
Traceback (most recent call last):
File "C:\Users\Username\tutorial\tutorial.py", line 8, in <module>
import numpy
ModuleNotFoundError: No module named 'numpy'
尝试在 anaconda 环境之外运行代码时,我也遇到了同样的问题。
C:\Users\Username\tutorial>pip install numpy
Requirement already satisfied: numpy in c:\programdata\anaconda3\lib\site-packages (1.18.1)
C:\Users\Username\tutorial>tutorial.py
Traceback (most recent call last):
File "C:\Users\Username\tutorial\tutorial.py", line 8, in <module>
import numpy
ModuleNotFoundError: No module named 'numpy'
当我安装 python 和 anaconda 时,我将两个安装程序都设置为 ADD TO PATH。
对此的任何帮助将不胜感激。