아니.. 너무 쉽자나.. (실행되는건 별개로)

 

$ pip install PyOpenGL PyOpenGL_accelerate
Collecting PyOpenGL
  Downloading https://files.pythonhosted.org/packages/9c/1d/4544708aaa89f26c97cc09450bb333a23724a320923e74d73e028b3560f9/PyOpenGL-3.1.0.tar.gz (1.2MB)
    100% |████████████████████████████████| 1.2MB 1.3MB/s
Collecting PyOpenGL_accelerate
  Downloading https://files.pythonhosted.org/packages/d9/74/293aa8794f2f236186d19e61c5548160bfe159c996ba01ed9144c89ee8ee/PyOpenGL-accelerate-3.1.0.tar.gz (323kB)
    100% |████████████████████████████████| 327kB 5.0MB/s
Building wheels for collected packages: PyOpenGL, PyOpenGL-accelerate
  Running setup.py bdist_wheel for PyOpenGL ... done
  Stored in directory: /home/minimonk/.cache/pip/wheels/6c/00/7f/1dd736f380848720ad79a1a1de5272e0d3f79c15a42968fb58
  Running setup.py bdist_wheel for PyOpenGL-accelerate ... done
  Stored in directory: /home/minimonk/.cache/pip/wheels/4e/8e/aa/ae3f1309ede1048b7f6a11c92d3d7d50fd6a7ab4507e6c7aca
Successfully built PyOpenGL PyOpenGL-accelerate
Installing collected packages: PyOpenGL, PyOpenGL-accelerate
Successfully installed PyOpenGL-3.1.0 PyOpenGL-accelerate-3.1.0

 

$ pip install pyopengl numpy glfw
Collecting pyopengl
Collecting numpy
  Downloading https://files.pythonhosted.org/packages/e1/72/179a78b565ecf01fe98dab6417581d30acac15c2d93c49f93169ebea99b1/numpy-1.16.3-cp27-cp27mu-manylinux1_x86_64.whl (17.0MB)
    100% |████████████████████████████████| 17.0MB 79kB/s
Collecting glfw
  Downloading https://files.pythonhosted.org/packages/5d/65/c6275744a01425195f1f446e022e5dfa6497aa68479a3952e434e04b2fa0/glfw-1.7.1.tar.gz
Building wheels for collected packages: glfw
  Running setup.py bdist_wheel for glfw ... done
  Stored in directory: /home/minimonk/.cache/pip/wheels/c5/53/f9/fd31798dce7e10aa49f8354e4111b9c9cad10c894184658663
Successfully built glfw
Installing collected packages: pyopengl, numpy, glfw
Successfully installed glfw-1.7.1 numpy-1.16.3 pyopengl-3.1.0

 

위에서 깔고깔고 하는데 라이브러리 없대서 또 깔고

ImportError: Failed to load GLFW3 shared library.

$ sudo apt-get install libglfw3
$ sudo apt-get install libglfw3-dev

[링크 : https://stackoverflow.com/.../importerror-failed-to-load-glfw3-shared-library-without-root-access-on-linux]

 

근데 실행안되네 -_ㅠ

얘는 아마도.. 원격지에서 X11 forwarding 하려고 해서 그런거 같고

$ python pygl_test.py
Traceback (most recent call last):
  File "pygl_test.py", line 92, in 
    main()
  File "pygl_test.py", line 10, in main
    if not glfw.init():
  File "/home/minimonk/.local/lib/python2.7/site-packages/glfw/__init__.py", line 607, in init
    res = _glfw.glfwInit()
  File "/home/minimonk/.local/lib/python2.7/site-packages/glfw/__init__.py", line 516, in errcheck
    _reraise(exc[1], exc[2])
  File "/home/minimonk/.local/lib/python2.7/site-packages/glfw/__init__.py", line 50, in _reraise
    exec("raise exception, None, traceback")
  File "/home/minimonk/.local/lib/python2.7/site-packages/glfw/__init__.py", line 495, in callback_wrapper
    return func(*args, **kwargs)
  File "/home/minimonk/.local/lib/python2.7/site-packages/glfw/__init__.py", line 669, in _raise_glfw_errors_as_exceptions
    raise GLFWError(message)
glfw.GLFWError: (65544) X11: RandR gamma ramp support seems broken

 

흐음.. python2.7 이라서 3.7을 깔고 했는데 pip 설치 경로에 따라 다른건가? 3.7에서는 해당 모듈을 불러오질 못한다.

$ python3.7 pygl_test.py
Traceback (most recent call last):
  File "pygl_test.py", line 1, in 
    import glfw
ModuleNotFoundError: No module named 'glfw'
Error in sys.excepthook:
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/apport_python_hook.py", line 63, in apport_excepthook
    from apport.fileutils import likely_packaged, get_recent_crashes
  File "/usr/lib/python3/dist-packages/apport/__init__.py", line 5, in 
    from apport.report import Report
  File "/usr/lib/python3/dist-packages/apport/report.py", line 30, in 
    import apport.fileutils
  File "/usr/lib/python3/dist-packages/apport/fileutils.py", line 23, in 
    from apport.packaging_impl import impl as packaging
  File "/usr/lib/python3/dist-packages/apport/packaging_impl.py", line 24, in 
    import apt
  File "/usr/lib/python3/dist-packages/apt/__init__.py", line 23, in 
    import apt_pkg
ModuleNotFoundError: No module named 'apt_pkg'

Original exception was:
Traceback (most recent call last):
  File "pygl_test.py", line 1, in 
    import glfw
ModuleNotFoundError: No module named 'glfw'

[링크 : https://github.com/totex/PyOpenGL_tutorials/blob/master/video_06_quad.py]

 

+

2019.05.04

ubuntu 깔고 native로 했는데 안된다.. ㅠㅠ GLSL3.30을 지원하지 않아서 라니 ㅠㅠ

$ python pygl.py 
No handlers could be found for logger "OpenGL.arrays.numpymodule"
Traceback (most recent call last):
  File "pygl.py", line 92, in 
    main()
  File "pygl.py", line 56, in main
    shader = OpenGL.GL.shaders.compileProgram(OpenGL.GL.shaders.compileShader(vertex_shader, GL_VERTEX_SHADER),
  File "/home/minimonk/.local/lib/python2.7/site-packages/OpenGL/GL/shaders.py", line 226, in compileShader
    shaderType,
RuntimeError: ('Shader compile failure (0): 0:2(10): error: GLSL 3.30 is not supported. Supported versions are: 1.10, 1.20, 1.30, 1.00 ES, and 3.00 ES\n', ['\n    #version 330\n    in vec3 position;\n    in vec3 color;\n\n    out vec3 newColor;\n    void main()\n    {\n        gl_Position = vec4(position, 1.0f);\n        newColor = color;\n    }\n    '], GL_VERTEX_SHADER)

 

+

걍 속시원하게 2.7 밀고 새로 깔고 클린하게~

sudo apt-get remove python
sudo apt-get remove python3.7
sudo apt-get autoremove
sudo apt-get install python3.7
sudo apt-get install python3-pip

[링크 : https://linuxize.com/post/how-to-install-python-3-7-on-ubuntu-18-04/]

[링크 : https://linuxize.com/post/how-to-install-pip-on-ubuntu-18.04/]

 

안되잖아! ㅠㅠ

$ python3 pygl_test.py
Traceback (most recent call last):
  File "pygl_test.py", line 92, in 
    main()
  File "pygl_test.py", line 10, in main
    if not glfw.init():
  File "/home/minimonk/.local/lib/python3.6/site-packages/glfw/__init__.py", line 607, in init
    res = _glfw.glfwInit()
  File "/home/minimonk/.local/lib/python3.6/site-packages/glfw/__init__.py", line 516, in errcheck
    _reraise(exc[1], exc[2])
  File "/home/minimonk/.local/lib/python3.6/site-packages/glfw/__init__.py", line 45, in _reraise
    raise exception.with_traceback(traceback)
  File "/home/minimonk/.local/lib/python3.6/site-packages/glfw/__init__.py", line 495, in callback_wrapper
    return func(*args, **kwargs)
  File "/home/minimonk/.local/lib/python3.6/site-packages/glfw/__init__.py", line 669, in _raise_glfw_errors_as_exceptions
    raise GLFWError(message)
glfw.GLFWError: (65544) b'X11: RandR gamma ramp support seems broken'

 

옛날 글이고 18.04 / python3에는 아래 패키지를 깔아주면 되는 듯.

$ sudo apt-get install python3-opengl
Install the distribution package as: sudo apt-get install python-opengl - this works for me.

[링크 : https://stackoverflow.com/questions/26700719/pyopengl-glutinit-nullfunctionerror]

 

일단은 해결~ 인가?

위에 쉐이더 쓰는건 원격으로 할 경우에는 방법이 없는 듯.. ㅠㅠ

[링크 : http://code.activestate.com/recipes/325391-open-a-glut-window-and-draw-a-sphere-using-pythono/]

'Programming > python(파이썬)' 카테고리의 다른 글

python pylint @ vscode  (0) 2019.05.09
python wxpython  (0) 2019.05.08
python 3.7 + MS build tool 2015 + pyGL 또 실패 ㅠㅠ  (0) 2019.05.01
python + openGL  (0) 2019.04.30
python + openCV 공부 시작  (0) 2019.04.30
Posted by 구차니

+

전체 사용자 설치로 하면 사용자 권한 문제로 pip로 설치시 안되는 수가 있어서 --user 옵션을 주어야 함

Could not install packages due to an EnvironmentError: [WinError 5] 액세스가 거부되었습니다: 'c:\\program files (x86)\\python37-32\\lib\\site-packages\\pip-19.0.3.dist-info\\entry_points.txt'
Consider using the `--user` option or check the permissions.

 

---

python 3.7.3에

mingw 실패

ms vs community에 14.0 빌드툴 추가해도 실패

 

python 3.4.3 에

mingw 실패

 

그래서 고민하다가 원래대로 해보겠다고 고생중

 

Microsoft Visual C++ 14.0 standalone: Visual C++ Build Tools 2015 (x86, x64, ARM)

This is a standalone version of Visual C++ 14.0 compiler, you don't need to install Visual Studio 2015.

  • Install Microsoft Visual C++ Build Tools 2015. Check Windows 8.1 SDK and Windows 10 SDK options.

  • The setuptools Python package version must be at least 24.0.

 Visual C++ Build Tools 2015 was upgraded by Microsoft to Build Tools for Visual Studio 2017. See the previous paragraph to install it.

[링크 : https://wiki.python.org/moin/WindowsCompilers]

 

 

microsoft visual C++ Build Tools 2015를 까는데 별다른 체크옵션 없던데..

[링크 : https://www.microsoft.com/ko-kr/download/details.aspx?id=48159]

 

아래 경로를 PATH에 추가

C:\Program Files (x86)\MSBuild\14.0\Bin

[링크 : http://www.sysnet.pe.kr/2/0/11275]

 

MSBuild tool 로도 안되네..

    ERROR: Complete output from command 'c:\program files (x86)\python37-32\python.exe' -u -c 'import setuptools, tokenize;__file__='"'"'C:\\Users\\shin\\AppData\\Local\\Temp\\pip-install-i1zl3xr6\\PyOpenGL-accelerate\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\shin\AppData\Local\Temp\pip-record-kda1gypo\install-record.txt' --single-version-externally-managed --compile --user --prefix=:
    ERROR: Unable to import numpy, skipping numpy extension building
    running install
    running build
    running build_py
    creating build
    creating build\lib.win32-3.7
    creating build\lib.win32-3.7\OpenGL_accelerate
    copying .\setup.py -> build\lib.win32-3.7\OpenGL_accelerate
    copying .\__init__.py -> build\lib.win32-3.7\OpenGL_accelerate
    running build_ext
    building 'OpenGL_accelerate.wrapper' extension
    error: Microsoft Visual C++ 14.0 is required. Get it with "Microsoft Visual C++ Build Tools": https://visualstudio.microsoft.com/downloads/
    ----------------------------------------
ERROR: Command "'c:\program files (x86)\python37-32\python.exe' -u -c 'import setuptools, tokenize;__file__='"'"'C:\\Users\\shin\\AppData\\Local\\Temp\\pip-install-i1zl3xr6\\PyOpenGL-accelerate\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\shin\AppData\Local\Temp\pip-record-kda1gypo\install-record.txt' --single-version-externally-managed --compile --user --prefix=" failed with error code 1 in C:\Users\shin\AppData\Local\Temp\pip-install-i1zl3xr6\PyOpenGL-accelerate\

 

visual studio community 받기

[링크 : https://visualstudio.microsoft.com/ko/downloads]

 

windows 8.1 / 10 SDK

[링크 : https://developer.microsoft.com/ko-kr/windows/downloads/sdk-archive]

 

 

+

2019.05.02

도대체 저걸 어떻게 해야하려나...

wrapper.c를 찾아봐야겠네

 C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Tools\MSVC\14.16.27023\bin\HostX86\x86\cl.exe
 /c /nologo /Ox /W3 /GL /DNDEBUG /MD 
-IC:\Users\shin\AppData\Local\Temp\pip-install-1qm70fwh\PyOpenGL-accelerate\.. 
-IC:\Users\shin\AppData\Local\Temp\pip-install-1qm70fwh\PyOpenGL-accelerate\src 
-IC:\Users\shin\AppData\Local\Temp\pip-install-1qm70fwh\PyOpenGL-accelerate 
"-Ic:\program files (x86)\python37-32\include" 
"-Ic:\program files (x86)\python37-32\include" 
"-IC:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Tools\MSVC\14.16.27023\include" 
"-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\ucrt" 
"-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\shared" 
"-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\um" 
"-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\winrt" 
"-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\cppwinrt" 
/Tcsrc\wrapper.c 
/Fobuild\temp.win32-3.7\Release\src\wrapper.obj

'Programming > python(파이썬)' 카테고리의 다른 글

python wxpython  (0) 2019.05.08
PyOpenGL + ubuntu 18.04  (0) 2019.05.02
python + openGL  (0) 2019.04.30
python + openCV 공부 시작  (0) 2019.04.30
pypy  (0) 2018.04.04
Posted by 구차니

해보려는데 영 안되네.. 설치 안한게 있어서 그런가?

 

C:\Users>pip install pyopengl numpy glfw
Collecting pyopengl
  Downloading https://files.pythonhosted.org/packages/9c/1d/4544708aaa89f26c97cc09450bb333a23724a320923e74d73e028b3560f9/PyOpenGL-3.1.0.tar.gz (1.2MB)
     |████████████████████████████████| 1.2MB 731kB/s
Requirement already satisfied: numpy in c:\users\shin\appdata\local\programs\python\python37-32\lib\site-packages (1.16.3)
Collecting glfw
  Downloading https://files.pythonhosted.org/packages/af/3b/2f8c60fcb0a486eae4dd18c29de22ed667aed5e81f16874102f8580b5900/glfw-1.7.1-py2.py3-none-win32.whl (55kB)
     |████████████████████████████████| 61kB 27kB/s
Installing collected packages: pyopengl, glfw
  Running setup.py install for pyopengl ... done
Successfully installed glfw-1.7.1 pyopengl-3.1.0

 

C:\study\python>python gl.py
Traceback (most recent call last):
  File "gl.py", line 92, in 
    main()
  File "gl.py", line 13, in main
    window = glfw.create_window(800, 600, "My OpenGL window", None, None)
  File "C:\Users\shin\AppData\Local\Programs\Python\Python37-32\lib\site-packages\glfw\__init__.py", line 893, in create_window
    monitor, share)
  File "C:\Users\shin\AppData\Local\Programs\Python\Python37-32\lib\site-packages\glfw\__init__.py", line 516, in errcheck
    _reraise(exc[1], exc[2])
  File "C:\Users\shin\AppData\Local\Programs\Python\Python37-32\lib\site-packages\glfw\__init__.py", line 45, in _reraise
    raise exception.with_traceback(traceback)
  File "C:\Users\shin\AppData\Local\Programs\Python\Python37-32\lib\site-packages\glfw\__init__.py", line 495, in callback_wrapper
    return func(*args, **kwargs)
  File "C:\Users\shin\AppData\Local\Programs\Python\Python37-32\lib\site-packages\glfw\__init__.py", line 669, in _raise_glfw_errors_as_exceptions
    raise GLFWError(message)
glfw.GLFWError: (65542) b'WGL: The driver does not appear to support OpenGL'

[링크 : https://webnautes.tistory.com/1271]

[링크 : https://answers.microsoft.com/.../no-opengl-acceleration-with-hd-3000-on-windows-10/...]

[링크 : https://www.intel.com/content/www/us/en/support/articles/000005526/graphics-drivers.html?language=en_US]

 

+

2019.05.01

 

홈페이지 가보니 PyOpenGL_accelerate 패키지를 안깔아서 그런가?

Downloading and Installation
The easiest way to install PyOpenGL is using pip

$ pip install PyOpenGL PyOpenGL_accelerate

[링크 : http://pyopengl.sourceforge.net/]

'Programming > python(파이썬)' 카테고리의 다른 글

PyOpenGL + ubuntu 18.04  (0) 2019.05.02
python 3.7 + MS build tool 2015 + pyGL 또 실패 ㅠㅠ  (0) 2019.05.01
python + openCV 공부 시작  (0) 2019.04.30
pypy  (0) 2018.04.04
파이썬 print가 희한하네..  (0) 2017.04.02
Posted by 구차니

지하철에서 잉여하지 말고 이거나 해야지

노트북에 웹캠도 있으니 딱이네

 

[링크 : https://diy-project.tistory.com/78]

[링크 : https://pypi.org/project/opencv-contrib-python/]

 

vscode와 연동하기

[링크 : https://realpython.com/python-development-visual-studio-code/]

 

+

C:\Users>pip install OpenCV-Python
Collecting OpenCV-Python
  Downloading https://files.pythonhosted.org/packages/99/ad/864b2f284517249a96190fdf6b21a291d9716115d6886938ccd86afaf821/opencv_python-4.1.0.25-cp37-cp37m-win32.whl (25.7MB)
    100% |████████████████████████████████| 25.7MB 439kB/s
Collecting numpy>=1.14.5 (from OpenCV-Python)
  Downloading https://files.pythonhosted.org/packages/ab/75/9ac63977cbca68e17406a53a8c573a925a16771800be47a73f18c838f3fb/numpy-1.16.3-cp37-cp37m-win32.whl (10.0MB)
    100% |████████████████████████████████| 10.0MB 371kB/s
Installing collected packages: numpy, OpenCV-Python
Successfully installed OpenCV-Python-4.1.0.25 numpy-1.16.3
You are using pip version 19.0.3, however version 19.1 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.

'Programming > python(파이썬)' 카테고리의 다른 글

python 3.7 + MS build tool 2015 + pyGL 또 실패 ㅠㅠ  (0) 2019.05.01
python + openGL  (0) 2019.04.30
pypy  (0) 2018.04.04
파이썬 print가 희한하네..  (0) 2017.04.02
파이썬 리스트(list)와 튜플(tuple)  (0) 2017.04.02
Posted by 구차니

예전에 적은게 있나 모르겠다만

그냥 생각나서 라즈베리에서 쳐보니까

기본으로 패키지 통합된 듯


pi@raspberrypi:~ $ python

Python 2.7.9 (default, Sep 17 2016, 20:26:04)

[GCC 4.9.2] on linux2

Type "help", "copyright", "credits" or "license" for more information.

>>> exit() 


pi@raspberrypi:~ $ pypy

Python 2.7.10 (4.0.1+dfsg-1+rpi1, Mar 07 2016, 10:36:18)

[PyPy 4.0.1 with GCC 4.9.2] on linux2

Type "help", "copyright", "credits" or "license" for more information.

>>>> exit() 


pi@raspberrypi:~ $ which python

/usr/bin/python

pi@raspberrypi:~ $ which pypy

/usr/bin/pypy

pi@raspberrypi:~ $ ll /usr/bin/pypy

lrwxrwxrwx 1 root root 22 Mar  8  2016 /usr/bin/pypy -> ../lib/pypy/bin/pypy-c

pi@raspberrypi:~ $ ll /usr/lib/pypy/bin

total 32604

drwxr-xr-x 2 root root     4096 Nov 26  2016 .

drwxr-xr-x 8 root root     4096 Nov 26  2016 ..

-rwxr-xr-x 1 root root 33374512 Mar  8  2016 pypy-c


'Programming > python(파이썬)' 카테고리의 다른 글

python + openGL  (0) 2019.04.30
python + openCV 공부 시작  (0) 2019.04.30
파이썬 print가 희한하네..  (0) 2017.04.02
파이썬 리스트(list)와 튜플(tuple)  (0) 2017.04.02
파이썬 type 확인하기  (0) 2017.04.02
Posted by 구차니

망할(!) 유니코드 ㅠㅠ

sqlite의 내용이 utf-8일텐데 아무튼.. 이걸 받아서 print 하니

죄다 u'\u' 이런식으로 유니코드 문자열을 알려주는 접두와 16진수로만 출력이 된다

그래서 이걸 정상적으로 출력하는걸 찾아보는데

간편하게 출력하는건 없고.. 파이썬 print 함수의 특징으로 봐야 하려나?


튜플,리스트 단위로 출력하면 escape 된 채로

항목 하나만 출력하면 정상적으로 한글로 나온다.

도대체 머야?!


아무튼 아래와 같이 하면 정상출력되긴 한다.( u' ' 접두는 붙는다.)

print repr(a).decode("unicode-escape") 

[링크 : http://stackoverflow.com/.../python-print-unicode-strings-in-arrays-as-characters-not-code-points]

'Programming > python(파이썬)' 카테고리의 다른 글

python + openCV 공부 시작  (0) 2019.04.30
pypy  (0) 2018.04.04
파이썬 리스트(list)와 튜플(tuple)  (0) 2017.04.02
파이썬 type 확인하기  (0) 2017.04.02
python sqlite3  (0) 2017.03.30
Posted by 구차니

튜플은 (1,2,3) 식으로 출력되고

리스트는 [1,2,3] 식으로 출력된다.


다만 내용적으로는 리스트는 순서가 변할수 있으며(순서가 의미가 없다)

튜플은 순서를 바꿀수 없다(즉, 순서에 의미가 있다)


4.6.5. Tuples

Tuples are immutable sequences, typically used to store collections of heterogeneous data (such as the 2-tuples produced by the enumerate() built-in). Tuples are also used for cases where an immutable sequence of homogeneous data is needed (such as allowing storage in a set or dict instance). 

[링크 : https://docs.python.org/3/library/stdtypes.html#tuples]


4.6.4. Lists

Lists are mutable sequences, typically used to store collections of homogeneous items (where the precise degree of similarity will vary by application). 

[링크 : https://docs.python.org/3/library/stdtypes.html#lists]

'Programming > python(파이썬)' 카테고리의 다른 글

pypy  (0) 2018.04.04
파이썬 print가 희한하네..  (0) 2017.04.02
파이썬 type 확인하기  (0) 2017.04.02
python sqlite3  (0) 2017.03.30
python smtplib의 신비..?  (0) 2016.12.30
Posted by 구차니


type(변수명) 


참 쉽네...

[링크 : http://chouingchou.tistory.com/53]

'Programming > python(파이썬)' 카테고리의 다른 글

파이썬 print가 희한하네..  (0) 2017.04.02
파이썬 리스트(list)와 튜플(tuple)  (0) 2017.04.02
python sqlite3  (0) 2017.03.30
python smtplib의 신비..?  (0) 2016.12.30
python이 인기라는데..  (0) 2014.03.19
Posted by 구차니

python에서 sqlite 파일을 접속해서 조작하는 방법


$ sudo apt-get install python-sqlite

Reading package lists... Done

Building dependency tree

Reading state information... Done

The following extra packages will be installed:

  libsqlite0

Suggested packages:

  python-sqlite-dbg

The following NEW packages will be installed:

  libsqlite0 python-sqlite

0 upgraded, 2 newly installed, 0 to remove and 7 not upgraded.

Need to get 141 kB of archives.

After this operation, 519 kB of additional disk space will be used.

Do you want to continue? [Y/n]

Get:1 http://mirrordirector.raspbian.org/raspbian/ jessie/main libsqlite0 armhf 2.8.17-12 [119 kB]

Get:2 http://mirrordirector.raspbian.org/raspbian/ jessie/main python-sqlite armhf 1.0.1-11 [21.3 kB]

Fetched 141 kB in 1s (95.8 kB/s)

Selecting previously unselected package libsqlite0.

(Reading database ... 137326 files and directories currently installed.)

Preparing to unpack .../libsqlite0_2.8.17-12_armhf.deb ...

Unpacking libsqlite0 (2.8.17-12) ...

Selecting previously unselected package python-sqlite.

Preparing to unpack .../python-sqlite_1.0.1-11_armhf.deb ...

Unpacking python-sqlite (1.0.1-11) ...

Setting up libsqlite0 (2.8.17-12) ...

Setting up python-sqlite (1.0.1-11) ...

Processing triggers for libc-bin (2.19-18+deb8u7) ...


pi@raspberrypi:~ $ cd src

pi@raspberrypi:~/src $ ll

total 2060

drwxr-xr-x  2 pi pi    4096 Mar 30 14:40 .

drwxr-xr-x 30 pi pi    4096 Mar 30 14:34 ..

-rw-r--r--  1 pi pi 2099200 Mar 29 12:29 sqlite.udb


pi@raspberrypi:~/src $ python

Python 2.7.9 (default, Sep 17 2016, 20:26:04)

[GCC 4.9.2] on linux2

Type "help", "copyright", "credits" or "license" for more information.

>>> import sqlite3

>>> conn = sqlite3.connect('sqlite.udb')

>>> c = conn.cursor()

>>> c.execute("select * from tbl_recv")

<sqlite3.Cursor object at 0x769eaa20> 


데이터가 유니코드로 나오나..

# we can also implement a custom text_factory ...

# here we implement one that will ignore Unicode characters that cannot be

# decoded from UTF-8

con.text_factory = lambda x: unicode(x, "utf-8", "ignore") 


[링크 : https://docs.python.org/2/library/sqlite3.html]

'Programming > python(파이썬)' 카테고리의 다른 글

파이썬 리스트(list)와 튜플(tuple)  (0) 2017.04.02
파이썬 type 확인하기  (0) 2017.04.02
python smtplib의 신비..?  (0) 2016.12.30
python이 인기라는데..  (0) 2014.03.19
python2 vs python3  (0) 2013.01.02
Posted by 구차니

어라?

파이썬으로 메일보내는데

새가

ㅅㅐ 로 보내지네.. 머지?


[링크 : http://unicode.scarfboy.com/?s=U%2BC0C8]

[링크 : http://unicode.scarfboy.com/?s=U%2b1109]

[링크 : http://unicode.scarfboy.com/?s=U%2b1162]



+

설정해도 안되고..

일단 ssh에서 직접 스크립트를 실행하면 한글이 안깨지고 가는데..

svn 통해서 hook 실행되면 깨진다.

[링크 : https://mikewest.org/2006/06/subversion-post-commit-hooks-101]

[링크 : http://svnbook.red-bean.com/nightly/en/svn.reposadmin.create.html#svn.reposadmin.create.hooks]

'Programming > python(파이썬)' 카테고리의 다른 글

파이썬 type 확인하기  (0) 2017.04.02
python sqlite3  (0) 2017.03.30
python이 인기라는데..  (0) 2014.03.19
python2 vs python3  (0) 2013.01.02
PyOpenGL  (0) 2011.10.04
Posted by 구차니