尽管安装了Anaconda,但在Anaconda中找不到软件包-ModulenotFoundError:NO模块名为' numpy'

发布于 2025-01-27 21:22:26 字数 2621 浏览 4 评论 0 原文

我认为我在不同的Python版本之间发生了冲突。这是新的安装Ubuntu 18.04。除了来的那个,我没有安装任何其他Python。我安装了 anaconda ,并指定了版本 3.7

(pcntorch) mk@mk-ub:~/PCN-PyTorch$ python --version
Python 3.7.13
(pcntorch) mk@mk-ub:~/PCN-PyTorch$ conda deactivate
mk@mk-ub:~/PCN-PyTorch$ python --version
Python 2.7.17

我已经通过Conda安装了所有必要的要求和库。运行 render_depth.py 错误。

blender -b -P render/render_depth.py 'ycb_cad_models_specific' 'obj_list.txt'  'outputdir' 8


Traceback (most recent call last):
  File "/home/mk/PCN-PyTorch/render/render_depth.py", line 27, in <module>
    import numpy as np
ModuleNotFoundError: No module named 'numpy'
Error: File format is not supported in file '/home/mk/PCN-PyTorch/ycb_cad_models_specific'

运行以下命令时:

python -mpip install numpy
Requirement already satisfied: numpy in /home/mk/anaconda3/envs/pcntorch/lib/python3.7/site-packages (1.21.6)

在几个[问题]中> 2 ,一个人对我的问题更具体,但没有帮助,我已经看到有时候解决方案是卸载Anaconda并再次安装。但是,由于我在康达(Conda)安装了一些库,我宁愿不这样做,例如,我遇到了同样的问题:

(pcntorch) mk@mk-ub:~/PCN-PyTorch/render$ python3 process_exr.py obj_list.txt ../outputdir/ 8
Traceback (most recent call last):
  File "process_exr.py", line 25, in <module>
    import Imath
ModuleNotFoundError: No module named 'Imath'
(pcntorch) mk@mk-ub:~/PCN-PyTorch/render$ python -mpip install imath
Requirement already satisfied: imath in /home/mk/anaconda3/envs/pcntorch/lib/python3.7/site-packages (0.0.1)

我的猜测是,道路在内部不匹配,但我很笨拙。 code

在激活环境中运行</

which python
/home/mk/anaconda3/envs/pcntorch/bin/python
>>> import sys
>>> print(sys.path)
['', '/home/mk/anaconda3/envs/pcntorch/lib/python37.zip', '/home/mk/anaconda3/envs/pcntorch/lib/python3.7', '/home/mk/anaconda3/envs/pcntorch/lib/python3.7/lib-dynload', '/home/mk/anaconda3/envs/pcntorch/lib/python3.7/site-packages', '/home/mk/anaconda3/envs/pcntorch/lib/python3.7/site-packages/chamfer_3D-0.0.0-py3.7-linux-x86_64.egg', '/home/mk/anaconda3/envs/pcntorch/lib/python3.7/site-packages/emd_cuda-0.0.0-py3.7-linux-x86_64.egg']

I think I am having conflict between different python versions. This is a fresh installed Ubuntu 18.04. I did not install any python other than the one that came. I installed anaconda, and specified the version 3.7.

(pcntorch) mk@mk-ub:~/PCN-PyTorch$ python --version
Python 3.7.13
(pcntorch) mk@mk-ub:~/PCN-PyTorch$ conda deactivate
mk@mk-ub:~/PCN-PyTorch$ python --version
Python 2.7.17

I already installed all the necessary requirements and libraries through conda. When running render_depth.py, I get the following error.

blender -b -P render/render_depth.py 'ycb_cad_models_specific' 'obj_list.txt'  'outputdir' 8


Traceback (most recent call last):
  File "/home/mk/PCN-PyTorch/render/render_depth.py", line 27, in <module>
    import numpy as np
ModuleNotFoundError: No module named 'numpy'
Error: File format is not supported in file '/home/mk/PCN-PyTorch/ycb_cad_models_specific'

When running the following command:

python -mpip install numpy
Requirement already satisfied: numpy in /home/mk/anaconda3/envs/pcntorch/lib/python3.7/site-packages (1.21.6)

In several [questions] 2, numpy is installed but astropy says numpy is not installed, and this one was more specific to my problem but didn't help , I have seen that sometimes the solution is to uninstall anaconda and install it again. But I would prefer not do to so at the moment due to some libraries I installed in conda, imath for example, and I get the same issue:

(pcntorch) mk@mk-ub:~/PCN-PyTorch/render$ python3 process_exr.py obj_list.txt ../outputdir/ 8
Traceback (most recent call last):
  File "process_exr.py", line 25, in <module>
    import Imath
ModuleNotFoundError: No module named 'Imath'
(pcntorch) mk@mk-ub:~/PCN-PyTorch/render$ python -mpip install imath
Requirement already satisfied: imath in /home/mk/anaconda3/envs/pcntorch/lib/python3.7/site-packages (0.0.1)

My guess is that somehow the paths are not matching internally, but I am quite clueless...

Running which python in the activated environment

which python
/home/mk/anaconda3/envs/pcntorch/bin/python
>>> import sys
>>> print(sys.path)
['', '/home/mk/anaconda3/envs/pcntorch/lib/python37.zip', '/home/mk/anaconda3/envs/pcntorch/lib/python3.7', '/home/mk/anaconda3/envs/pcntorch/lib/python3.7/lib-dynload', '/home/mk/anaconda3/envs/pcntorch/lib/python3.7/site-packages', '/home/mk/anaconda3/envs/pcntorch/lib/python3.7/site-packages/chamfer_3D-0.0.0-py3.7-linux-x86_64.egg', '/home/mk/anaconda3/envs/pcntorch/lib/python3.7/site-packages/emd_cuda-0.0.0-py3.7-linux-x86_64.egg']

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文