【发布时间】:2020-04-01 03:06:54
【问题描述】:
我通过 pip 正常安装了 tkcalendar,一切正常:
C:\Users\Pavel>python -m pip install tkcalendar
Collecting tkcalendar
Downloading https://files.pythonhosted.org/packages/44/18/2d6a50fd9703a4cf96a24d12aee5a21b33e75d0b3e6b25fa4dcd7d06efc1/tkcalendar-1.5.1-py3-none-any.whl
Collecting babel (from tkcalendar)
Downloading https://files.pythonhosted.org/packages/2c/60/f2af68eb046c5de5b1fe6dd4743bf42c074f7141fe7b2737d3061533b093/Babel-2.7.0-py2.py3-none-any.whl (8.4MB)
|████████████████████████████████| 8.4MB 6.4MB/s
Requirement already satisfied: pytz>=2015.7 in c:\users\pavel\appdata\local\packages\pythonsoftwarefoundation.python.3.7_qbz5n2kfra8p0\localcache\local-packages\python37\site-packages (from babel->tkcalendar) (2019.3)
Installing collected packages: babel, tkcalendar
Successfully installed babel-2.7.0 tkcalendar-1.5.1
然而,当我尝试运行我的脚本时,我收到了一个找不到模块的错误:
File "C:/Python_working/exercies/tkinter.py", line 7, in <module>
from tkcalendar import Calendar, DateEntry
ModuleNotFoundError: No module named 'tkcalendar'
我尝试重新启动 Spyder,尝试使用 pip 重新安装,但我只收到一条消息说软件包已安装。
最后,我尝试使用conda 安装软件包,但出现以下错误:
PackagesNotFoundError: The following packages are not available from current channels:
- tkcalendar
不知道还有什么办法可以解决这个问题。
使用 Python 3.7 和 Spyder 3.3.6。
更新:
从命令提示符运行 python 然后运行import tkcalendar 工作正常。
我在 github 上找到了this guide to working with virtual environments in Spyder,但似乎有点过头了...
【问题讨论】:
标签: python python-3.x anaconda tkcalendar