Art of asking questions

Art of asking questions

0 前言

提問的藝術
在遇到一個問題的時候,怎樣清晰的提出問題,並請求別人來給予你幫助,下面是一個栗子,希望對你有用。

ImportError: No module named gevent

導入錯誤:沒有叫gevent的模塊

I am new to the Python application development in Ubuntu.

在Ubuntu下進行Python的應用程序開發,我是一個新手。

I would try to be concise but please forgive and ask me if my explanations is too unclear to understand. I would be appreciated for your answers.

我會盡量簡明扼要,如果我的解釋不太明確難以理解,請原諒,並問我。我很感激你的回答。

1- I have created a virtual environment for a project using “virtualenv” command called cyoa.

在一個項目中我使用 “virtualenv” 的cyoa命令創造了一個虛擬的環境

2- PostGres DB is installed and I have created user name and password to connect to the database.

安裝了Postgres DB,我創建好了用戶名和密碼來連接數據庫

3- The environment variable is like follow:

環境變量如下

   #!/bin/bash

    export DEBUG=False

    export SECRET_KEY='supersecretproductionkeyforapp'

    export DATABASE_URL='postgres://username:password@localhost/cyoa'

    # Redis settings

    export REDIS_SERVER='localhost'

    export REDIS_PORT='6379'

    export REDIS_DB='1'

    # Twilio settings

    export TWILIO_ACCOUNT_SID=''

    export TWILIO_AUTH_TOKEN=''

    export TWILIO_NUMBER=''

    # Celery

    export CELERY_BROKER_URL='redis://localhost:6379/0'

    export CELERY_RESULT_BACKEND='redis://localhost:6379/0'

4- When I activate the virtual environment and try to run the following script

當我激活虛擬環境,試圖運行下列腳本的時候

  (cyoa)$ python manage.py syncdb

First lines of the manage script (which error is related to):

管理腳本的第一行,錯誤與此相關

    from gevent import monkey
    monkey.patch_all()

    import os
    import redis

I get the following error:

我得到了下列錯誤

    Traceback (most recent call last):
    File "manage.py", line 1, in <module>
    from gevent import monkey
    ImportError: No module named gevent

gevent final version is installed using the command:

使用命名安裝gevent最終版本

 $sudo pip install gevent
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章