0

Mac での Falcon の実行に問題があります。私はpycharmと一緒にpython 2.7をしばらく問題なく使用しています。

ここここ、およびここに関連する投稿がいくつかあるようですが、それでも同じ問題があるようです。

これを機能させるために何時間も費やしましたが、すべてが6つのパッケージとSSLを指しているようです。

以下は、これまでの私の取り組みです。どんな助けでも大歓迎です

MYMACBOOKPRO:falcon my.user$ sw_vers -productVersion
10.10.2

MYMACBOOKPRO:falcon my.user$ python --version
Python 2.7.10

MYMACBOOKPRO:falcon my.user$ pip install six --upgrade
Requirement already up-to-date: six in /Library/Python/2.7/site-packages

MYMACBOOKPRO:falcon my.user$ sudo pip install pyopenssl ndg-httpsclient
Password:
The directory '/Users/my.user/Library/Caches/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/Users/my.user/Library/Caches/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Requirement already satisfied (use --upgrade to upgrade): pyopenssl in /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python
Requirement already satisfied (use --upgrade to upgrade): ndg-httpsclient in /Library/Python/2.7/site-packages

MYMACBOOKPRO:falcon my.user$ sudo pip install six --upgrade
The directory '/Users/my.user/Library/Caches/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/Users/my.user/Library/Caches/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Requirement already up-to-date: six in /Library/Python/2.7/site-packages

MYMACBOOKPRO:falcon my.user$ sudo pip install pyopenssl ndg-httpsclient
The directory '/Users/my.user/Library/Caches/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/Users/my.user/Library/Caches/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Requirement already satisfied (use --upgrade to upgrade): pyopenssl in /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python
Requirement already satisfied (use --upgrade to upgrade): ndg-httpsclient in /Library/Python/2.7/site-packages

MYMACBOOKPRO:falcon my.user$ openssl version
OpenSSL 1.0.2d 9 Jul 2015

MYMACBOOKPRO:falcon my.user$ sudo pip install gunicorn --upgrade
The directory '/Users/my.user/Library/Caches/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/Users/my.user/Library/Caches/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Requirement already up-to-date: gunicorn in /Library/Python/2.7/site-package

MYMACBOOKPRO:falcon my.user$ cat things.py
# things.py

# Let's get this party started
import falcon


# Falcon follows the REST architectural style, meaning (among
# other things) that you think in terms of resources and state
# transitions, which map to HTTP verbs.
class ThingsResource:
    def on_get(self, req, resp):
        """Handles GET requests"""
        resp.status = falcon.HTTP_200  # This is the default status
        resp.body = ('\nTwo things awe me most, the starry sky '
                     'above me and the moral law within me.\n'
                     '\n'
                     '    ~ Immanuel Kant\n\n')

# falcon.API instances are callable WSGI apps
app = falcon.API()

# Resources are represented by long-lived class instances
things = ThingsResource()

# things will handle all requests to the '/things' URL path
app.add_route('/things', things)

MYMACBOOKPRO:falcon my.user$ gunicorn things:app
[2015-11-20 08:38:42 -0500] [66479] [INFO] Starting gunicorn 19.3.0
[2015-11-20 08:38:42 -0500] [66479] [INFO] Listening at: http://127.0.0.1:8000 (66479)
[2015-11-20 08:38:42 -0500] [66479] [INFO] Using worker: sync
[2015-11-20 08:38:42 -0500] [66482] [INFO] Booting worker with pid: 66482
[2015-11-20 08:38:42 -0500] [66482] [ERROR] Exception in worker process:
Traceback (most recent call last):
  File "/Library/Python/2.7/site-packages/gunicorn/arbiter.py", line 507, in spawn_worker
    worker.init_process()
  File "/Library/Python/2.7/site-packages/gunicorn/workers/base.py", line 118, in init_process
    self.wsgi = self.app.wsgi()
  File "/Library/Python/2.7/site-packages/gunicorn/app/base.py", line 67, in wsgi
    self.callable = self.load()
  File "/Library/Python/2.7/site-packages/gunicorn/app/wsgiapp.py", line 65, in load
    return self.load_wsgiapp()
  File "/Library/Python/2.7/site-packages/gunicorn/app/wsgiapp.py", line 52, in load_wsgiapp
    return util.import_app(self.app_uri)
  File "/Library/Python/2.7/site-packages/gunicorn/util.py", line 355, in import_app
    __import__(module)
  File "/Users/my.user/falcon/things.py", line 4, in <module>
    import falcon
  File "/Library/Python/2.7/site-packages/falcon/__init__.py", line 32, in <module>
    from falcon.api import API, DEFAULT_MEDIA_TYPE  # NOQA
  File "/Library/Python/2.7/site-packages/falcon/api.py", line 22, in <module>
    from falcon.request import Request, RequestOptions
  File "/Library/Python/2.7/site-packages/falcon/request.py", line 35, in <module>
    from six.moves.http_cookies import SimpleCookie
ImportError: No module named http_cookies
Traceback (most recent call last):
  File "/Library/Python/2.7/site-packages/gunicorn/arbiter.py", line 507, in spawn_worker
    worker.init_process()
  File "/Library/Python/2.7/site-packages/gunicorn/workers/base.py", line 118, in init_process
    self.wsgi = self.app.wsgi()
  File "/Library/Python/2.7/site-packages/gunicorn/app/base.py", line 67, in wsgi
    self.callable = self.load()
  File "/Library/Python/2.7/site-packages/gunicorn/app/wsgiapp.py", line 65, in load
    return self.load_wsgiapp()
  File "/Library/Python/2.7/site-packages/gunicorn/app/wsgiapp.py", line 52, in load_wsgiapp
    return util.import_app(self.app_uri)
  File "/Library/Python/2.7/site-packages/gunicorn/util.py", line 355, in import_app
    __import__(module)
  File "/Users/my.user/falcon/things.py", line 4, in <module>
    import falcon
  File "/Library/Python/2.7/site-packages/falcon/__init__.py", line 32, in <module>
    from falcon.api import API, DEFAULT_MEDIA_TYPE  # NOQA
  File "/Library/Python/2.7/site-packages/falcon/api.py", line 22, in <module>
    from falcon.request import Request, RequestOptions
  File "/Library/Python/2.7/site-packages/falcon/request.py", line 35, in <module>
    from six.moves.http_cookies import SimpleCookie
ImportError: No module named http_cookies
[2015-11-20 08:38:42 -0500] [66482] [INFO] Worker exiting (pid: 66482)
Traceback (most recent call last):
  File "/usr/local/bin/gunicorn", line 11, in <module>
    sys.exit(run())
  File "/Library/Python/2.7/site-packages/gunicorn/app/wsgiapp.py", line 74, in run
    WSGIApplication("%(prog)s [OPTIONS] [APP_MODULE]").run()
  File "/Library/Python/2.7/site-packages/gunicorn/app/base.py", line 189, in run
    super(Application, self).run()
  File "/Library/Python/2.7/site-packages/gunicorn/app/base.py", line 72, in run
    Arbiter(self).run()
  File "/Library/Python/2.7/site-packages/gunicorn/arbiter.py", line 174, in run
    self.manage_workers()
  File "/Library/Python/2.7/site-packages/gunicorn/arbiter.py", line 477, in manage_workers
    self.spawn_workers()
  File "/Library/Python/2.7/site-packages/gunicorn/arbiter.py", line 541, in spawn_workers
    time.sleep(0.1 * random.random())
  File "/Library/Python/2.7/site-packages/gunicorn/arbiter.py", line 214, in handle_chld
    self.reap_workers()
  File "/Library/Python/2.7/site-packages/gunicorn/arbiter.py", line 459, in reap_workers
    raise HaltServer(reason, self.WORKER_BOOT_ERROR)
gunicorn.errors.HaltServer: <HaltServer 'Worker failed to boot.' 3>
4

2 に答える 2

0

コマンドの実行:

$ pip install falcon

0.3.0エラーを与えるファルコンバージョンをインストールします:ImportError: No module named http_cookies

python.org のパッケージを使用してファルコンをインストールします

次に、次のようにパッケージをインストールします。

$ pip install falcon-1.0.0rc1.tar.gz

于 2016-04-03T22:23:42.523 に答える
0

環境に問題がある可能性があります。私はMacを使用していますが、問題はありませんでした。確認するには、virtualenv を使用してみてください。

pip install virtualenv
virtualenv test
source ./test/bin/activate
pip install falcon
pip install gunicorn
cd go/to/your/falcon/app/path
gunicorn things:app

うまくいかない場合は、pip を再インストールしてみてください。それが機能するかどうか教えてください。

于 2016-03-25T19:12:59.090 に答える