PythonAnywhere – 如何使用我安装的模块?
PythonAnywhere – How do I use the modules I install?
我对如何在 PythonAnywhere 中 install/use 新模块感到困惑。
例如,我在 Bash 控制台中安装了模块 ephem
pip3.6 install --user ephem
一切顺利。如果我再次 运行 上面的命令,它会说;
Looking in links: /usr/share/pip-wheels
Requirement already satisfied: ephem in ./.local/lib/python3.6/site-packages (3.7.7.0)
但是,当我尝试在我的脚本中使用它时,我得到:
Traceback (most recent call last): File "/home/krollibrius/montaulieu.py", line 7, in <module> import ephem ModuleNotFoundError: No module named 'ephem'
有人可以帮忙吗?
可能你用错了python版本,试试添加
import sys
print(sys.version)
添加到您的脚本中。我发现大多数时候我将软件包安装到错误的版本。
另一种解决方案是使用命令 pythonwithversionnumber -m pip install --user ephem
。将 pythonwithversionnumber 替换为您用于 运行 您的脚本
的命令
我对如何在 PythonAnywhere 中 install/use 新模块感到困惑。
例如,我在 Bash 控制台中安装了模块 ephem
pip3.6 install --user ephem
一切顺利。如果我再次 运行 上面的命令,它会说;
Looking in links: /usr/share/pip-wheels
Requirement already satisfied: ephem in ./.local/lib/python3.6/site-packages (3.7.7.0)
但是,当我尝试在我的脚本中使用它时,我得到:
Traceback (most recent call last): File "/home/krollibrius/montaulieu.py", line 7, in <module> import ephem ModuleNotFoundError: No module named 'ephem'
有人可以帮忙吗?
可能你用错了python版本,试试添加
import sys
print(sys.version)
添加到您的脚本中。我发现大多数时候我将软件包安装到错误的版本。
另一种解决方案是使用命令 pythonwithversionnumber -m pip install --user ephem
。将 pythonwithversionnumber 替换为您用于 运行 您的脚本