py2exe使用'请求'

时间:2016-11-28 18:03:27

标签: python python-3.4

代码(简单版)

import requests

url = 'https://...'
payload = {'key1': 'value1'}
r = requests.post(url, data=payload)

精彩地工作。

问题

虽然我没有使用py2exe:

ImportError: No module named 'requests'

创可贴是在 setup.py 中包含以下内容:

import requests.certs

build_exe_options = {"include_files":[(requests.certs.where(),'cacert.pem')]}

出现了一个新问题:

Traceback (most recent call last):
File "posturl.py", line 5, in <module>
File "C:\Python34\lib\site-packages\requests\__init__.py", line 63, in <module>
from . import utils
File "C:\Python34\lib\site-packages\requests\utils.py", line 24, in <module>
from ._internal_utils import to_native_string
File "C:\Python34\lib\site-packages\requests\_internal_utils.py", line 11, in <module>
from .compat import is_py2, builtin_str
File "C:\Python34\lib\site-packages\requests\compat.py", line 11, in <module>
from .packages import chardet
File "C:\Python34\lib\site-packages\requests\packages\__init__.py", line 29, in <module>
import urllib3
File "C:\Python34\lib\site-packages\urllib3\__init__.py", line 8, in <module>
from .connectionpool import (
File "C:\Python34\lib\site-packages\urllib3\connectionpool.py", line 28, in <module>
from .packages.six.moves.queue import LifoQueue, Empty, Full
File "C:\Python34\lib\site-packages\urllib3\packages\six.py", line 203, in load_module
mod = mod._resolve()
File "C:\Python34\lib\site-packages\urllib3\packages\six.py", line 115, in _resolve
return _import_module(self.mod)
File "C:\Python34\lib\site-packages\urllib3\packages\six.py", line 82, in _import_module
__import__(name)
ImportError: No module named 'queue'

我尝试在setup.py上添加导入队列,但没有雪茄。

我可以在这里编写脚本的独立exe文件吗?

0 个答案:

没有答案