so i upgraded to Mavericks hoping that my scripts would be fine . . . luckily when I run my scripts in Coderunner they work . i do simple test scripts in the terminal because its easy and i like the way it looks. i'm not sure why the frameworks work in coderunner but not the terminal.
does anyone have any idea how to fix this ?
i tried updating the software and got the same error
Last login: Wed Oct 30 11:08:51 on ttys000
opus-magnum:~ Opus_Magnum$ python
Python 2.7.5 (v2.7.5:ab05e7dd2788, May 13 2013, 13:18:45)
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> s = 'hello'
>>> print s
Segmentation fault: 11
opus-magnum:~ Opus_Magnum$
`
You are not running the correct version of python that was released with OS X Mavericks.
[1:17pm][wlynch#watermelon ~] /usr/bin/python2.7
Python 2.7.5 (default, Aug 25 2013, 00:04:04)
[GCC 4.2.1 Compatible Apple LLVM 5.0 (clang-500.0.68)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>>
Related
I am running jupyter on mac
If I choose python3 and I import a package that works only on python3 I have the following:
However If I do:
python3
Python 3.6.8 (v3.6.8:3c6b436a57, Dec 24 2018, 02:10:22)
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import mgwr
it works fine
I created virtualenv for few months. And I encountered a problem.
When I activate virtual environment I have access to lib like django :
source virtualenv/jsms/bin/activate
(jsms)local% python
Python 3.4.3 (v3.4.3:9b73f1c3e601, Feb 23 2015, 02:52:03)
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import django
>>> exit()
(jsms)local% deactivate
But when I use python from the bin folder I can't access to django :
local% virtualenv/jsms/bin/python
Python 2.7.10 (default, Oct 23 2015, 19:19:21)
[GCC 4.2.1 Compatible Apple LLVM 7.0.0 (clang-700.0.59.5)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import django
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named django
More strange, when I use python3.4 from the bin folder, I am using python 2.7 :
local% virtualenv/jsms/bin/python3.4
Python 2.7.10 (default, Oct 23 2015, 19:19:21)
[GCC 4.2.1 Compatible Apple LLVM 7.0.0 (clang-700.0.59.5)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
Do you know a way to access lib directly from python in the bin folder ?
activate is just a bash script, so you can always take a look at the activate file and see what it is doing, but I think what you’re looking for is the env variable PYTHONHOME. I would try:
export OLD_PYTHON_HOME="$PYTHONHOME"
unset PYTHONHOME
virtualenv/jsms/bin/python3.4 --version
For windows, you would use the following code from the activate.bat template:
if defined PYTHONHOME (
set _OLD_VIRTUAL_PYTHONHOME=%PYTHONHOME%
set PYTHONHOME=
)
I've successfully compiled the caffe library and the python module.
I can do this:
Jamess-Air:~ james$ python2 -V
Python 2.7.10
Jamess-Air:~ james$ python2
Python 2.7.10 (default, Jul 13 2015, 12:05:58)
[GCC 4.2.1 Compatible Apple LLVM 6.1.0 (clang-602.0.53)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import caffe
>>>
But, bizarrely, this fails:
Jamess-Air:~ james$ python2.7 -V
Python 2.7.10
Jamess-Air:~ james$ python2.7
Python 2.7.10 (default, Jun 19 2015, 15:39:31)
[GCC 4.2.1 Compatible Apple LLVM 6.1.0 (clang-602.0.53)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import caffe
Segmentation fault: 11
Jamess-Air:~ james$
I cannot understand this at all! Whenever I try to run using iPython notebook I get the same crash.
Any ideas as to what may be causing this, and how I might fix it, or at least get iPython Notebook to use the different python version so I can run this thing?
Thanks!
I try to visualize graph with matplotlib in python but I have few problem in my mac (Yosemite 10.10.2). I already installed matplotlib, and I know that I have 2 version of python installed in my computer, which are 2.7.8 and 2.7.6
Using default interpreter which is python 2.7.8, I got this error
dhcPlus-mbp:~ macbook$ python
Python 2.7.8 (v2.7.8:ee879c0ffa11, Jun 29 2014, 21:07:35)
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import matplotlib
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named matplotlib
But if I try this one, it works on terminal. But I can't build straight from my Sublime with Ctrl+B
dhcPlus-mbp:~ macbook$ /usr/bin/python
Python 2.7.6 (default, Sep 9 2014, 15:04:36)
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.39)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import matplotlib
>>>
My question is, how could I change default python interpreter so I can use the 2.7.6 in my environment?
Any help is greatly appreciated. Thank you very much.
This problem solved by removing the extra Python libraries on Mavericks by
sudo rm -rf /Library/Frameworks/Python.framework/
I have installed numpy and opencv using macports as per these instructions, but when I try import cv or import cv2 I just get the segfault and I have no idea why.
Any suggestions?
$ python
Python 2.7.6 (default, Sep 9 2014, 15:04:36)
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.39)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import cv
Segmentation fault: 11
$ python
Python 2.7.6 (default, Sep 9 2014, 15:04:36)
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.39)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import cv2
Segmentation fault: 11
Sorry there are so few details, but this is a new computer and I installed macports on it just for this, and these are the only things I've installed with macports, so I have no idea why this isn't working.
Edit: Now I'm More Confused.
Looking through the crash report I found this:
Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_INVALID_ADDRESS at 0x0000000000000000
So, as a shot in the dark, I ran python as super user:
$ sudo python
Python 2.7.9 (default, Dec 13 2014, 15:13:49)
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.56)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import cv
>>>
As super user, everything appears to run fine. How is this possible?
If you look closely to the info message of your python command, you will see the difference.
From the buggy one:
$ python
Python 2.7.6 (default, Sep 9 2014, 15:04:36)
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.39)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import cv2
Segmentation fault: 11
From the working one:
$ sudo python
Python 2.7.9 (default, Dec 13 2014, 15:13:49)
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.56)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import cv
>>>
You have two different versions of Python on your machine which might explain the behaviors you got.
After hitting this problem on OSX 10.11 and trawling through several cases of this problem in various contexts, I realized that this problem happens due to following independent reasons mostly:
conflicting python versions (more than one pythons); solution - uninstall one of them, get the one thats compatible with opencv ("Segmentation fault" during "import cv" on Mac OS)
opencv version issue; solution - get the right version for you Python opencv feature detector causes segmentation fault
issue with your numpy version; solution - uninstall and install numpy again (OpenCV - cannot find module cv2)
I tried all 3 but number 3 solved my issue.
Using
cv2.ocl.setUseOpenCL(False)
at the beginning of the code solved the problem for me.
For me the solution was simply
sudo apt install python3-opencv
and then install pip opencv package
sudo pip3 install opencv-python
or
sudo pip install opencv-python
Note: This was because I have launched a new Aws instance.
I encountered the similar problem.
➜ ~ ✗ python
Python 3.6.0 |Continuum Analytics, Inc.| (default, Dec 23 2016, 13:19:00)
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.57)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import cv2
[1] 41233 segmentation fault python
But if I import numpy first, the problem will go away.
➜ ~ ✗ python
Python 3.6.0 |Continuum Analytics, Inc.| (default, Dec 23 2016, 13:19:00)
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.57)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import numpy as np
>>> import cv2
>>>