如果我用python在本地运行代码主.py,则在本地发生此错误。如果我用Python3主.py,它按预期工作。我怀疑我的azure应用服务没有运行正确版本的python,但是它被设置为python3.4
StdErr:
2018-06-30 19:47:13.785205: Unhandled exception in wfastcgi.py: Traceback (most recent call last):
File "D:\Python34\Scripts\wfastcgi.py", line 711, in main
env, handler = read_wsgi_handler(response.physical_path)
File "D:\Python34\Scripts\wfastcgi.py", line 568, in read_wsgi_handler
return env, get_wsgi_handler(handler_name)
File "D:\Python34\Scripts\wfastcgi.py", line 541, in get_wsgi_handler
handler = handler()
File ".\ptvs_virtualenv_proxy.py", line 120, in get_venv_handler
handler = get_wsgi_handler(os.getenv('WSGI_ALT_VIRTUALENV_HANDLER'))
File ".\ptvs_virtualenv_proxy.py", line 89, in get_wsgi_handler
raise ValueError('"%s" could not be imported%s' % (handler_name, last_tb))
ValueError: "main.app" could not be imported: Traceback (most recent call last):
File ".\ptvs_virtualenv_proxy.py", line 73, in get_wsgi_handler
handler = __import__(module_name, fromlist=[name_list[0][0]])
File "D:\home\site\wwwroot\main.py", line 2, in <module>
from newspaper import Article
ImportError: No module named 'newspaper'
更新
所以我去kudo的调试控制台运行python
-m pip install --upgrade -r d:\home\site\wwwroot\requirements.txt
。在
这是错误
^{pr2}$其中一个需求是Pillow,它需要libxml2和libxslt。我试过用轮子,但是没有成功。在
更新II 我试图安装virtualenv,因为它不存在,我收到一个权限错误。在
更新III 我执行了这个命令
D:\home\python364x64>python -m pip install newspaper3k
我在本地测试所有的东西,它运行得很好。我按下并接收下面的错误。在
Error occurred while reading WSGI handler:
Traceback (most recent call last):
File "D:\home\python364x64\wfastcgi.py", line 791, in main
env, handler = read_wsgi_handler(response.physical_path)
File "D:\home\python364x64\wfastcgi.py", line 633, in read_wsgi_handler
handler = get_wsgi_handler(os.getenv("WSGI_HANDLER"))
File "D:\home\python364x64\wfastcgi.py", line 600, in get_wsgi_handler
handler = __import__(module_name, fromlist=[name_list[0][0]])
File ".\app.py", line 8, in <module>
from newspaper import Article
File "D:\home\python364x64\lib\site-packages\newspaper\__init__.py", line 10, in <module>
from .api import (build, build_article, fulltext, hot, languages,
File "D:\home\python364x64\lib\site-packages\newspaper\api.py", line 12, in <module>
import feedparser
File "D:\home\python364x64\lib\site-packages\feedparser.py", line 316
raise KeyError, "object doesn't have key 'category'"
^
SyntaxError: invalid syntax
StdOut:
StdErr:
根据我的经验,我们无权修改
D:\home
环境。在所以,最好使用python扩展。请按照本例中的步骤操作:Azure Flask Routes Not found并使用命令
python -m pip install newspaper
在python扩展中安装其他包。在请确保要安装的包必须与python扩展的版本匹配。否则,将抛出如下错误。在
希望对你有帮助。在
相关问题 更多 >
编程相关推荐