+46

ctypes can't be imported in Linux

Fredrik Ehnbom 13 year бұрын updated by 美龙 谢 12 year бұрын 8
Go to the python console and type "import ctypes" in build 2139 and you'll get:

>>> import ctypes
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File ".\ctypes\__init__.py", line 10, in <module>
ImportError: No module named _ctypes
This strikes me as a specific instance of the more general problem that ST2 doesn't link against the system Python on Linux.  Of course, in order for that to work there would have to be specific packages of ST2 for each platform, since each distro builds its own, and may have different versions...  Still, that would be great, and it would make the binary smaller :).
+1
This is so import, but why it still exists now?
FYI, there's an easy workaround for this issue with the help of pythonbrew:
  1. curl -kL http://xrl.us/pythonbrewinstall | bash
  2. source "$HOME/.pythonbrew/etc/bashrc"
  3. pythonbrew install --configure="--enable-unicode=ucs4" 2.6
  4. ln -s $HOME/.pythonbrew/pythons/Python-2.6/lib/python2.6/ <your Sublime Text 2 folder>/lib/python2.6 
Hello. I get this error when I try to enable the clang plugin in Sublime. Tried this recently but I get the same error when I start Sublime. 
Any thoughts? 
I'm using Ubuntu 12.04 (running in VirtualBox). I used the package control plugin to get Clang.
Thank you for your time.

I am using 64bit ubuntu 12.10. but your sulotion is not work for me.

your should change "<your Sublime Text 2 folder>" to "/usr/lib/sublime-text-2"

I treat it as "/usr/shared/sublime text 2" before, so it doesn't work.

but 

"sudo ln -s /usr/lib/python2.6 /usr/lib/sublime-text-2/lib/python2.6" worked

Also, if you have installed python2.6 on your Linux box, you could ink the library directory to your SimpeText2 folder:


ln -s /usr/lib/python2.6 SUBLIME_TEXT_2_DIRECTORY/lib/python2.6