我在虚拟环境中运行“本地圣杯”。我没有看到虚拟环境中安装的库。从 chalicelib/common.py 文件中,我看到要设置的路径(sys.path):
['/home/sudip/myapp', '/usr/local/bin', '/usr/lib/python36.zip', '/usr/lib/python3.6', '/usr/lib/python3.6/lib-dynload', '/usr/local/lib/python3.6/dist-packages', '/usr/lib/python3/dist-packages']
但是当我从虚拟环境控制台运行 python3.6 时,我看到了这个:
(venv) myapp$ python3.6
Python 3.6.5 (default, Mar 29 2018, 03:28:50)
[GCC 5.4.0 20160609] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> print (sys.path)
['', '/home/sudip/myapp/venv/lib/python36.zip', '/home/sudip/myapp/venv/lib/python3.6', '/home/sudip/myapp/venv/lib/python3.6/lib-dynload', '/usr/lib/python3.6', '/home/sudip//myapp/venv/lib/python3.6/site-packages']
>>>
此处路径设置正确。为什么在前一种情况下不会发生。因此,当我运行我的应用程序时,我遇到了很多模块导入错误,例如:ModuleNotFoundError: No module named 'jwt'。有人可以帮忙吗?
谢谢, 苏迪普