Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/349.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 让Falcon在Mac上运行时遇到问题_Python_Macos_Six_Falcon_Falconframework - Fatal编程技术网

Python 让Falcon在Mac上运行时遇到问题

Python 让Falcon在Mac上运行时遇到问题,python,macos,six,falcon,falconframework,Python,Macos,Six,Falcon,Falconframework,我在Mac上运行Falcon有个挑战。我使用Python2.7和pycharm已经有一段时间了,没有任何问题 似乎有几个相关的帖子,但似乎仍然有相同的问题 我花了很多时间试图让它工作,所有东西似乎都指向六个包和SSL 以下是我迄今为止的努力。非常感谢您的帮助 MYMACBOOKPRO:falcon my.user$ sw_vers -productVersion 10.10.2 MYMACBOOKPRO:falcon my.user$ python --version Python 2.7.1

我在Mac上运行Falcon有个挑战。我使用Python2.7和pycharm已经有一段时间了,没有任何问题

似乎有几个相关的帖子,但似乎仍然有相同的问题

我花了很多时间试图让它工作,所有东西似乎都指向六个包和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>
MYMACBOOKPRO:falcon my.user$sw\u vers-productVersion
10.10.2
MYMACBOOKPRO:falcon my.user$python——版本
Python 2.7.10
MYMACBOOKPRO:falcon my.user$pip安装六个--升级
需求已经更新:6个in/Library/Python/2.7/site-packages
MYMACBOOKPRO:falcon my.user$sudo pip安装pyopenssl ndg httpsclient
密码:
当前用户不拥有目录“/Users/my.user/Library/Caches/pip/http”或其父目录,缓存已被禁用。请检查该目录的权限和所有者。如果使用sudo执行pip,您可能需要sudo的-H标志。
当前用户不拥有目录“/Users/my.user/Library/Caches/pip”或其父目录,并且已禁用缓存控制盘。检查该目录的权限和所有者。如果使用sudo执行pip,您可能需要sudo的-H标志。
已满足要求(使用--升级以升级):pyopenssl in/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/Python
已满足要求(使用--升级到升级):ndg httpsclient in/Library/Python/2.7/site-packages
MYMACBOOKPRO:falcon my.user$sudo pip安装六个--升级
当前用户不拥有目录“/Users/my.user/Library/Caches/pip/http”或其父目录,缓存已被禁用。请检查该目录的权限和所有者。如果使用sudo执行pip,您可能需要sudo的-H标志。
当前用户不拥有目录“/Users/my.user/Library/Caches/pip”或其父目录,并且已禁用缓存控制盘。检查该目录的权限和所有者。如果使用sudo执行pip,您可能需要sudo的-H标志。
需求已经更新:6个in/Library/Python/2.7/site-packages
MYMACBOOKPRO:falcon my.user$sudo pip安装pyopenssl ndg httpsclient
当前用户不拥有目录“/Users/my.user/Library/Caches/pip/http”或其父目录,缓存已被禁用。请检查该目录的权限和所有者。如果使用sudo执行pip,您可能需要sudo的-H标志。
当前用户不拥有目录“/Users/my.user/Library/Caches/pip”或其父目录,并且已禁用缓存控制盘。检查该目录的权限和所有者。如果使用sudo执行pip,您可能需要sudo的-H标志。
已满足要求(使用--升级以升级):pyopenssl in/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/Python
已满足要求(使用--升级到升级):ndg httpsclient in/Library/Python/2.7/site-packages
MYMACBOOKPRO:falcon my.user$openssl版本
OpenSSL 1.0.2d 2015年7月9日
MYMACBOOKPRO:falcon my.user$sudo pip安装gunicorn——升级
当前用户不拥有目录“/Users/my.user/Library/Caches/pip/http”或其父目录,缓存已被禁用。请检查该目录的权限和所有者。如果使用sudo执行pip,您可能需要sudo的-H标志。
当前用户不拥有目录“/Users/my.user/Library/Caches/pip”或其父目录,并且已禁用缓存控制盘。检查该目录的权限和所有者。如果使用sudo执行pip,您可能需要sudo的-H标志。
需求已经更新:gunicorn in/Library/Python/2.7/site-package
MYMACBOOKPRO:falcon my.user$cat things.py
#事情很糟糕
#让我们开始这个派对吧
进口猎鹰
#Falcon遵循REST的建筑风格,意思是
#其他事情),你认为在资源和状态方面
#转换,映射到HTTP谓词。
类别信息来源:
def on_get(自身、请求、响应):
“”“处理获取请求”“”
resp.status=falcon.HTTP#200#这是默认状态
resp.body=(“\n最令我敬畏的两件事,星空”
“在我之上和我内在的道德法则。\n”
“\n”
“~Immanuel Kant\n\n”
#falcon.API实例是可调用的WSGI应用程序
app=falcon.API()
#资源由长寿命类实例表示
things=ThingsResource()
#things将处理对'/things'URL路径的所有请求
app.add_路线('/things',things)
MYMACBOOKPRO:falcon my.user$gunicorn things:app
[2015-11-20 08:38:42-0500][66479][INFO]启动gunicorn 19.3.0
[2015-11-20 08:38:42-0500][66479][INFO]收听:http://127.0.0.1:8000 (66479)
[2015-11-20 08:38:42-0500][66479][INFO]使用辅助程序:同步
[2015-11-20 08:38:42-0500][66482][INFO]带pid的引导工人:66482
[2015-11-20 08:38:42-0500][66482][错误]工人流程中的异常:
回溯(最近一次呼叫最后一次):
文件“/Library/Python/2.7/site packages/gunicorn/arbiter.py”,第507行,位于spawn_worker中
worker.init_进程()
文件“/Library/Python/2.7/site packages/gunicorn/workers/base.py”,第118行,在init_进程中
self.wsgi=self.app.wsgi()
wsgi中的文件“/Library/Python/2.7/site packages/gunicorn/app/base.py”,第67行
self.callable=self.load()
文件“/Library/Python/2.7/site packages/gunicorn/app/wsgiapp.py”,第65行,已加载
返回self.load_wsgiapp()
文件“/Library/Python/2.7/site packages/gunicorn/app/wsgiapp.py”,第52行,在loadwsgiapp中
return util.import\u app(self.app\u uri)
导入应用程序中的文件“/Library/Python/2.7/site packages/gunicorn/util.py”,第355行
__导入(模块)
文件“/Users/my.user/falcon/things.py”,第4行,在
进口猎鹰
文件“/Library/Python/2.7/site-packages/falcon/_-init___uuu.py”,第32行,在
从falcon.api导入api,默认\媒体\类型