使用venv时出现ModuleNotFoundError

问题描述 投票:1回答:1

我刚刚在Mac Catalina机器上安装了Python 3.8。我使用PyCharm创建了一个新的虚拟环境,并使用PyCharm的首选项安装了slackclient软件包。但是,无论我尝试运行该应用程序的哪种方式,都会出现ModuleNotFoundError: No module named 'slackclient'错误。我已经验证它已安装在OS终端(zsh)中:

(venv) *** pip list            
Package       Version
------------- -------
aiohttp       3.6.2  
async-timeout 3.0.1  
attrs         19.3.0 
chardet       3.0.4  
idna          2.9    
multidict     4.7.5  
pip           20.0.2 
setuptools    46.1.3 
slackclient   2.5.0  
yarl          1.4.2  
(venv) *** python studiobot.py 
Traceback (most recent call last):
  File "studiobot.py", line 4, in <module>
    from slackclient import SlackClient
ModuleNotFoundError: No module named 'slackclient'

我在做什么错?预先感谢!

python python-3.x pycharm virtualenv
1个回答
3
投票

您应该使用类似的东西

from slack import WebClient

https://github.com/slackapi/python-slackclient#sending-a-message-to-slack

© www.soinside.com 2019 - 2024. All rights reserved.