Python无法在网站包

时间:2016-08-18 21:11:08

标签: python django pip packages

我正在尝试使用PayPal的休息sdk,并且在其api.py文件中,它尝试导入的模块之一是请求,但它正在抛出一个"没有模块名称&# 39;请求'错误&#34 ;.我最近从使用项目中的Python2.7切换到Python3.5。我用pip-3.5安装请求安装了请求,我现在可以在我的python3.5 site-packages目录中看到这些请求,但它仍然抛出错误?它不会为同一目录中的其他模块抛出错误,例如' logging'和' json'只有请求。下面是从我的lib目录开始的树结构。我试图尽可能地清理它。

tree python3.5 / site-packages /

├── README
├── __pycache__
│   ├── easy_install.cpython-35.opt-1.pyc
│   └── easy_install.cpython-35.pyc
├── easy_install.py
├── pip
│   ├── __init__.py
│   ├── __main__.py
│   ├── __pycache__
│   │   ├── __init__.cpython-35.opt-1.pyc
│   │   ├── __init__.cpython-35.pyc
│   │   ├── __main__.cpython-35.opt-1.pyc
│   │   ├── __main__.cpython-35.pyc
│   │   ├── basecommand.cpython-35.opt-1.pyc
│   │   ├── basecommand.cpython-35.pyc
│   │   ├── baseparser.cpython-35.opt-1.pyc
│   │   ├── baseparser.cpython-35.pyc
│   │   ├── cmdoptions.cpython-35.opt-1.pyc
│   │   ├── cmdoptions.cpython-35.pyc
│   │   ├── download.cpython-35.opt-1.pyc
│   │   ├── download.cpython-35.pyc
│   │   ├── exceptions.cpython-35.opt-1.pyc
│   │   ├── exceptions.cpython-35.pyc
│   │   ├── index.cpython-35.opt-1.pyc
│   │   ├── index.cpython-35.pyc
│   │   ├── locations.cpython-35.opt-1.pyc
│   │   ├── locations.cpython-35.pyc
│   │   ├── pep425tags.cpython-35.opt-1.pyc
│   │   ├── pep425tags.cpython-35.pyc
│   │   ├── status_codes.cpython-35.opt-1.pyc
│   │   ├── status_codes.cpython-35.pyc
│   │   ├── wheel.cpython-35.opt-1.pyc
│   │   └── wheel.cpython-35.pyc
├── requests
│   ├── __init__.py
│   ├── __pycache__
│   │   ├── __init__.cpython-35.pyc
│   │   ├── adapters.cpython-35.pyc
│   │   ├── api.cpython-35.pyc
│   │   ├── auth.cpython-35.pyc
│   │   ├── certs.cpython-35.pyc
│   │   ├── compat.cpython-35.pyc
│   │   ├── cookies.cpython-35.pyc
│   │   ├── exceptions.cpython-35.pyc
│   │   ├── hooks.cpython-35.pyc
│   │   ├── models.cpython-35.pyc
│   │   ├── sessions.cpython-35.pyc
│   │   ├── status_codes.cpython-35.pyc
│   │   ├── structures.cpython-35.pyc
│   │   └── utils.cpython-35.pyc
│   ├── adapters.py
│   ├── api.py
│   ├── auth.py
│   ├── cacert.pem
│   ├── certs.py
│   ├── compat.py
│   ├── cookies.py
│   ├── exceptions.py
│   ├── hooks.py
│   ├── models.py

myprojectroot / third_party / paypalrestsdk / api.py(进口)

来自未来导入部门

import base64
import datetime
import requests
import json
import logging
import os
import platform
import ssl

import paypalrestsdk.util as util
from paypalrestsdk import exceptions
from paypalrestsdk.config import __version__, __endpoint_map__

堆栈跟踪

Traceback (most recent call last):
  File "/Applications/PyCharm.app/Contents/helpers/pydev/pydevd.py", line 1531, in <module>
    globals = debugger.run(setup['file'], None, None, is_module)
  File "/Applications/PyCharm.app/Contents/helpers/pydev/pydevd.py", line 938, in run
    pydev_imports.execfile(file, globals, locals)  # execute the script
  File "/Applications/PyCharm.app/Contents/helpers/pydev/_pydev_imps/_pydev_execfile.py", line 18, in execfile
    exec(compile(contents+"\n", file, 'exec'), glob, loc)
  File "/Users/timothybaney/Django_Projects/creek_kooler/manage.py", line 15, in <module>
    execute_from_command_line(sys.argv)
  File "/Users/timothybaney/virt_python_35/lib/python3.5/site-packages/django/core/management/__init__.py", line 353, in execute_from_command_line
    utility.execute()
  File "/Users/timothybaney/virt_python_35/lib/python3.5/site-packages/django/core/management/__init__.py", line 302, in execute
    settings.INSTALLED_APPS
  File "/Users/timothybaney/virt_python_35/lib/python3.5/site-packages/django/conf/__init__.py", line 55, in __getattr__
    self._setup(name)
  File "/Users/timothybaney/virt_python_35/lib/python3.5/site-packages/django/conf/__init__.py", line 43, in _setup
    self._wrapped = Settings(settings_module)
  File "/Users/timothybaney/virt_python_35/lib/python3.5/site-packages/django/conf/__init__.py", line 99, in __init__
    mod = importlib.import_module(self.SETTINGS_MODULE)
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 986, in _gcd_import
  File "<frozen importlib._bootstrap>", line 969, in _find_and_load
  File "<frozen importlib._bootstrap>", line 958, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 673, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 665, in exec_module
  File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed
  File "/Users/timothybaney/Django_Projects/creek_kooler/settings/development.py", line 3, in <module>
    from third_party import paypalrestsdk
  File "/Users/timothybaney/Django_Projects/creek_kooler/third_party/paypalrestsdk/__init__.py", line 1, in <module>
    from paypalrestsdk.api import Api, set_config, configure
  File "/Users/timothybaney/Django_Projects/creek_kooler/third_party/paypalrestsdk/__init__.py", line 1, in <module>
    from paypalrestsdk.api import Api, set_config, configure
  File "/Users/timothybaney/Django_Projects/creek_kooler/third_party/paypalrestsdk/api.py", line 5, in <module>
    import requests
ImportError: No module named 'requests'

0 个答案:

没有答案