[英]Setting python3.2 as default instead of python2.7 on Mac OSX Lion 10.7.5
[英]Difficulty Setting Up Numpy for Python 2.7 on Mac OSX
我正在嘗試使用Python 2.7運行我的腳本。 當我跑步
python2.7
我懂了
Python 2.7.10 (default, May 25 2015, 13:06:17)
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.56)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>>
當我嘗試運行腳本時,我得到:
Traceback (most recent call last):
File "bcp.py", line 1, in <module>
import numpy as np
ImportError: No module named numpy
因此,Python 2.7似乎並不了解numpy。 當我跑步
pip2.7 install numpy
我得到:
Requirement already satisfied (use --upgrade to upgrade): numpy in /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python
Cleaning up...
知道這里發生了什么嗎?
謝謝!
這可能是因為您在計算機上使用了錯誤的python發行版。 如果您使用的是OSX計算機,則/ usr / local /中可能存在python發行版,而/ System / Library / Frameworks中可能存在一個python發行版。 似乎python2.7可能鏈接到/ usr /中的一個。
嘗試
which python2.7
應該找到鏈接到哪個python發行版“ python2.7”。 如果您鏈接到/ usr /,只需將其更改為/ System / Library中的那個,您的numpy應該可以工作。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.