没有模块命名为Facebook错误Py2exe

时间:2015-09-23 18:13:30

标签: python module py2exe named

我有以下问题,我的脚本工作正常,但是当我使用py2exe编译时会抛出以下错误:

Traceback (most recent call last):
   File "MyFile.py", line 2, in <module>
ImportError: No module named facebook

我尝试创建一个名为&#34的文件夹; facebook&#34;在build文件夹中,但它抛出错误。这个时间类型:

 Traceback (most recent call last):
   File  "MyFile.py", line 13, in <module>
   File "facebook\__init__pyc", line 103, in get_object
   File "facebook\__init__pyc", line 245, in request
   File "requests\api.pyc", line 50, in request
   File "requests\session.pyc", line 465, in request
   File "requests\session.pyc", line 573, in send
   File "requests\adapters.pyc", line 431, in send
requests.exceptions.SSLError: [Errno 185090050] _ssl.c:344: error:0B084002:x509 
certificate routines: X509_load_cert_crl_file: system lib

我的代码使用起来非常简单,没有编译就可以正常工作:

> from facepy import GraphAPI
> import facebook
> graph = facebook.GraphAPI(AccessToken)
> graph.get_object()

这是我在p2exe中的setup.py文件

from distutils.core import setup
import py2exe
import os
setup(console=['MyFile.py']) 

非常感谢

1 个答案:

答案 0 :(得分:0)

将此信息放在你的“import facebook”上方的脚本中

import sys
sys.path.append("/some/path") #this is the directory that facebook.py is in