When I tried to execute a certain python file, I got the following error.
$ python [filename].py
Fatal Python error: PyThreadState_Get: no current thread
[1] 1588 abort python [filename].py
By the way, the conditions were as follows.
--Other python files can be executed --It was feasible before the clean install --You are using an external library (gurobipy)
It was the type of error I saw for the first time, so I investigated what was the cause, and in a nutshell, (from the beginning?) Something went wrong between the python bundled with the Mac and the python installed with brew. It seems that they are in conflict with each other. I don't know the reason, but maybe it wasn't good that python managed it with brew.
By saying that, I have uninstalled python of brew.
brew uninstall python
This is the solution. You can now execute it safely. Probably the cause is that the versions of the two pythons are different (mac is 2.7.6 and brew is 2.7.9), and the path is not working well because of that, but I do not understand well. However, since the latest tasks are accumulated, I will pretend not to see it.
If anyone is familiar with it, I would appreciate it if you could easily tell me the cause.
According to gurobi developer Greg Glockner, gurobi only supports python, which is installed by default on OS X. In other words, there is no choice but to downgrade brew python, uninstall (erase), or unlink (pause).
By the way, I decided to unlink. For the time being, simply
brew unlink python
Stop at and when necessary
brew link python
It's a translation to revive with, it's really easy! Or only when running gurobi in python
import os
os.system('brew unlink python')
(Execution content)
os.system('brew link python')
It may be easier to write like this.
I don't think it has been resolved, but I was refreshed because I somehow found the cause.
Recommended Posts