python - 尽管安装了 simple-smartsheet,脚本仍返回 ModuleNotFoundError
问题描述
我正在使用 Python 3.7 运行 Anaconda,并且我想在脚本中使用simple_smartsheet模块。我安装了 Smartsheet
!pip install simple-smartsheet
它显示成功(见下文),但是在运行我的脚本时,我得到一个ModuleNotFoundError
. 为什么找不到模块?
这是脚本:
import logging
import csv
import os
import sys
from pprint import pprint
import pandas as pd
from datetime import date
logging.basicConfig(filename='rwsheet.log', level=logging.INFO)
SheetID="Smartsheet Sheet Name"
# simple_smartsheet is a more user friendly tool to allow for everyday transactions with
# Smartsheet's API. Believe it or not, it is much better than what Smartsheet provides.
from simple_smartsheet import Smartsheet
from simple_smartsheet.models import Sheet, Column, Row, Cell, ColumnType
# Add SMARTSHEET_ACCESS_TOKEN to environment .bashrc. It holds the token assigned
# from Smartsheet to access remotely.
TOKEN = "*****************"
# Name of the Smartsheet being updated
SHEET_ID = SheetID
smartsheet = Smartsheet(TOKEN)
print("SHEET_ID: ", SHEET_ID)
sheet = smartsheet.sheets.get(SHEET_ID)
运行后,这是它发出的确切错误:
Traceback (most recent call last) <ipython-input-3-e2d38a84d6b8> in <module>
13 # simple_smartsheet is a more user freindly tool to allow for everyday transactions with
14 # Smartsheet's API. Beleive it or not, it is much better that what Smartsheet provides.
---> 15 from simple_smartsheet import Smartsheet
16 from simple_smartsheet.models import Sheet, Column, Row, Cell, ColumnType
17
ModuleNotFoundError: No module named 'simple_smartsheet'
这是安装命令的输出:
!pip install simple-smartsheet
Requirement already satisfied: simple-smartsheet in c:\users\cabbs\anaconda3\envs\p37workshop\lib\site-packages (0.5.0)
Requirement already satisfied: attrs in c:\users\cabbs\anaconda3\envs\p37workshop\lib\site-packages (from simple-smartsheet) (19.3.0)
Requirement already satisfied: requests in c:\users\cabbs\anaconda3\envs\p37workshop\lib\site-packages (from simple-smartsheet) (2.24.0)
Requirement already satisfied: cattrs in c:\users\cabbs\anaconda3\envs\p37workshop\lib\site-packages (from simple-smartsheet) (1.0.0)
Requirement already satisfied: mypy-extensions in c:\users\cabbs\anaconda3\envs\p37workshop\lib\site-packages (from simple-smartsheet) (0.4.3)
Requirement already satisfied: aiohttp in c:\users\cabbs\anaconda3\envs\p37workshop\lib\site-packages (from simple-smartsheet) (3.7.2)
Requirement already satisfied: marshmallow<4,>=3 in c:\users\cabbs\anaconda3\envs\p37workshop\lib\site-packages (from simple-smartsheet) (3.8.0)
Requirement already satisfied: idna<3,>=2.5 in c:\users\cabbs\anaconda3\envs\p37workshop\lib\site-packages (from requests->simple-smartsheet) (2.10)
Requirement already satisfied: certifi>=2017.4.17 in c:\users\cabbs\anaconda3\envs\p37workshop\lib\site-packages (from requests->simple-smartsheet) (2020.6.20)
Requirement already satisfied: chardet<4,>=3.0.2 in c:\users\cabbs\anaconda3\envs\p37workshop\lib\site-packages (from requests->simple-smartsheet) (3.0.4)
Requirement already satisfied: urllib3!=1.25.0,!=1.25.1,<1.26,>=1.21.1 in c:\users\cabbs\anaconda3\envs\p37workshop\lib\site-packages (from requests->simple-smartsheet) (1.25.9)
Requirement already satisfied: async-timeout<4.0,>=3.0 in c:\users\cabbs\anaconda3\envs\p37workshop\lib\site-packages (from aiohttp->simple-smartsheet) (3.0.1)
Requirement already satisfied: yarl<2.0,>=1.0 in c:\users\cabbs\anaconda3\envs\p37workshop\lib\site-packages (from aiohttp->simple-smartsheet) (1.6.2)
Requirement already satisfied: multidict<7.0,>=4.5 in c:\users\cabbs\anaconda3\envs\p37workshop\lib\site-packages (from aiohttp->simple-smartsheet) (5.0.0)
Requirement already satisfied: typing-extensions>=3.6.5 in c:\users\cabbs\anaconda3\envs\p37workshop\lib\site-packages (from aiohttp->simple-smartsheet) (3.7.4.2)
解决方案
我最终放弃了 p37workshop 环境并在 Anaconda 默认设置下运行。它运行没有问题!我试图运行 Python 3.7 版本,这就是我创建 p37workshop 的原因。但是,我刚刚了解到我可以使用最新的 Python 版本,所以我不需要继续尝试让 p37workshop 工作。
谢谢你看看。我使用 simple_smartsheet 的次数越多,我就越惊讶于它在多大程度上使与 Smartsheet 的交互变得如此简单。
推荐阅读
- tensorflow - 无法在 PyCharm 2019.2 中导入 Keras(来自 TensorFlow 2.0)
- angular - 用于传递数据父级的 Observable 和 EventEmitter (Angular)
- python - 将 Python 配置为复杂的 Django 项目
- amazon-web-services - 由 ansible 提供的打包程序在 aws codebuild 中失败
- javascript - 在较大字符串中的特定字符串之前返回第一次出现的时间正则表达式
- c# - 在 Vuforia for Unity 中查找地平面的变换旋转值
- python - 需要修复无法更新 conda all package 的错误吗?
- azure-sql-database - 在更短的时间内将 50GB CSV 文件 Azure Blob 加载到 Azure SQL DB - 性能
- python - Azure Functions 中的多处理
- java - 在 github 项目中找不到主要类