尽管安装了简单智能表,脚本仍返回ModuleNotFoundError

时间:2020-10-29 16:09:03

标签: python pip conda smartsheet-api

我正在使用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)

1 个答案:

答案 0 :(得分:0)

我彻底放弃了p37workshop环境,并在Anaconda默认设置下运行。它运行没有问题!我试图运行Python 3.7版本,这就是为什么我创建了p37workshop的原因。但是,我刚刚了解到我可以使用最新的Python版本,因此无需继续尝试使p37workshop正常工作。

感谢您的关注。我在simple_smartsheet上使用的越多,我就对它如何使与Smartsheet的交互变得更加轻松而感到困惑。