2014-02-24 3 views
0

플라스크 응용 프로그램 내에서 동적 그래프를 만들 수 있기를 원합니다. Linux 환경에서이 응용 프로그램을 가상 환경에서 실행하고 있습니다.플라스크 Pygal 설치 - pygal이라는 모듈 없음

나는 이것으로 나를 도울 다른 라이브러리를 둘러 보았고 Pygal을 내가 사용하고자하는 것으로 확인했다.

따라서 을 사용하여 가상 환경을 활성화하고 pip install pygal을 사용하여 설치했습니다. 모든 것이 올바르게 설치되었고 일반 파이썬 인터페이스를 사용하여 완벽하게 가져올 수 있습니다.

그러나 Fluch 응용 프로그램에 import pygal을 넣고 응용 프로그램을 실행하면 로그에 다음 오류가 표시됩니다.

Traceback (most recent call last): 
    File "/usr/share/nginx/www/mydir/run.py", line 2, in <module> 
     from app import app 
    File "/usr/share/nginx/www/mydir/app/__init__.py", line 23, in <module> 
     from app import views, models 
    File "/usr/share/nginx/www/mydir/views.py", line 9, in <module> 
     import datetime, locale, pygal 
    ImportError: No module named pygal 

아무도 내가 이것을 해결할 수있는 방법을 알고 있습니까?

감사합니다.

- 편집 -

RE : 숀 비에이라 내 실행 스크립트에 from sys import path; print(path)를 추가

결과 : 해결

*** Starting uWSGI 1.9.20 (32bit) on [Tue Feb 25 14:55:16 2014] *** 
compiled with version: 4.6.3 on 04 December 2013 05:11:40 
os: Linux-3.8.0-29-generiC#42~precise1-Ubuntu SMP Wed Aug 14 15:31:16 UTC 2013 
nodename: **hidden** 
machine: i686 
clock source: unix 
detected number of CPU cores: 1 
current working directory: /etc/uwsgi/vassals 
detected binary path: /usr/share/nginx/www/mydir/venv/bin/uwsgi 
!!! no internal routing support, rebuild with pcre support !!! 
your processes number limit is 3840 
your memory page size is 4096 bytes 
detected max file descriptor number: 1024 
lock engine: pthread robust mutexes 
thunder lock: disabled (you can enable it with --thunder-lock) 
uwsgi socket 0 bound to UNIX address /usr/share/nginx/www/mydir/mydir_uwsgi.sock fd 3 
Python version: 2.7.3 (default, Sep 26 2013, 20:26:19) [GCC 4.6.3] 
Set PythonHome to /usr/share/nginx/www/mydir/venv 
*** Python threads support is disabled. You can enable it with --enable-threads *** 
Python main interpreter initialized at 0x93e80a8 
your server socket listen backlog is limited to 100 connections 
your mercy for graceful operations on workers is 60 seconds 
mapped 169864 bytes (165 KB) for 1 cores 
*** Operational MODE: single process *** 
added /usr/share/nginx/www/mydir/ to pythonpath. 
['/usr/share/nginx/www/mydir/', '.', '',  '/usr/share/nginx/www/mydir/venv/lib/python2.7/site-packages/distribute-0.6.24-py2.7.egg', '/usr/share/nginx/www/mydir/venv/lib/python2.7/site-packages/pip-1.1-py2.7.egg', '/usr/share/nginx/www/mydir/venv/lib/python2.7', '/usr/share/nginx/www/mydir/venv/lib/python2.7/plat-linux2', '/usr/share/nginx/www/mydir/venv/lib/python2.7/lib-tk', '/usr/share/nginx/www/mydir/venv/lib/python2.7/lib-old', '/usr/share/nginx/www/mydir/venv/lib/python2.7/lib-dynload', '/usr/lib/python2.7', '/usr/lib/python2.7/plat-linux2', '/usr/lib/python2.7/lib-tk', '/usr/share/nginx/www/mydir/venv/lib/python2.7/site-packages'] 
WSGI app 0 (mountpoint='') ready in 1 seconds on interpreter 0x93e80a8 pid: 20964  (default app) 
*** uWSGI is running in multiple interpreter mode *** 
spawned uWSGI master process (pid: 20964) 
spawned uWSGI worker 1 (pid: 20981, cores: 1) 
+0

Flask 응용 프로그램이 PyGal을 설치 한 가상 환경에서 실행되고 있습니까? –

+0

나는 그것이 아주 확실하다. 나는 이것을 확인할 것인가? – LJPPython

+0

플라스크 시작 코드'from sys import path; print (path)'를 클릭하고 가상 환경이 해당 목록에 있는지 확인하십시오. –

답변

0

문제.

this question에 대한 대답에서 설명한대로 sys.path에 패키지의 경로를 추가해야했습니다. Pygal을 어떤 이유로 가상 환경에 설치할 수 없기 때문에.