简体   繁体   English

python-ImportError:在Mac上没有名为scipy的模块

[英]python - ImportError: No module named scipy on Mac

It's been so hard to find solution for this problem. 很难找到解决该问题的方法。

I've been reading on the internet and found this questions on Stackoverflow: 我一直在互联网上阅读,并在Stackoverflow上发现了以下问题:

Solution #1 and Solution #2 with no results. 解决方案1解决方案2没有结果。

When I use: 当我使用时:

pip install scipy

It outputs 它输出

Requirement already satisfied (use --upgrade to upgrade): scipy in /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python

Then I do 那我做

pip install scipy --updrage

And it outputs 它输出

OSError: [Errno 1] Operation not permitted: 
'/var/folders/y3/r_j97_g91494mm7r9th0zycm0000gn/T/pip-paR57c-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/numpy-1.8.0rc1-py2.7.egg-info'

I even try to install using port : 我什至尝试使用port安装:

sudo port install py27-numpy py27-scipy py27-matplotlib py27-ipython +notebook py27-pandas py27-sympy py27-nose

Same result, it says it's been installed but when I try to run my Python project, prints the same error. 同样的结果,它说它已经安装了,但是当我尝试运行我的Python项目时,会输出相同的错误。

Hope you guys can help me. 希望你们能帮助我。

I believe that your issue may be how you are running your code - OS-X can have both the system python and a user python installation. 我相信您的问题可能是您如何运行代码-OS-X可以同时安装系统python和用户python。

From the command prompt, (the same one that pip tells you that you already have scipy installed), try running your script, which I will assume is called your_script.py with: 在命令提示符下(pip告诉您已经安装了scipy),尝试运行您的脚本, 我假设它被称为your_script.py其中包含:

python your_script.py

And it should work, however if you run: 它应该可以工作,但是如果您运行:

your_script.py

it may not work. 它可能不起作用。

I don't have a Mac to experiment on but you should do some reading on this issue online - here 我没有Mac可以试用,但是您应该在线阅读有关此问题的一些信息- 这里

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM