尽管我刚刚安装了它,但在Visual Studio代码中找不到错误
我想使用Cherrypy模块运行Python脚本。我使用pip install cherrypy
安装它,看上去还不错。然后,我单击“运行python文件”按钮,然后面对错误modulenotfounderror:无名为'Cherrypy'的模块
。
试图重新安装Cherrypy,我看到许多要求已经满足
响应。
如果有帮助,我已经编辑了,在用户路径变量面板中,路径变量和添加c:\ users \ username \ appdata \ local \ local \ program \ python \ python \ python37-37-32 \ scripts
作为路径。
编辑:我怀疑这条路的问题。所以我运行以下内容。
>>> import os
>>> import sys
>>> os.path.dirname(sys.executable)
'C:\\Python25'
它返回:'c:\\用户\\用户名\\ appdata \\ local \\ microsoft \\ windowsapps \\ pythonsoftwarefoundation.python.3.9_qbz5n2kfra8pp0'
I want to run a python script with the cherrypy module. I use pip install cherrypy
to install it and all looks ok. Then I click the "Run python file" button and I face the error ModuleNotFoundError: No module named 'cherrypy'
.
Trying to reinstall cherrypy I see many Requirement already satisfied
responses.
If it helps I have already edit, in the user path variables panel, the Path variable and added C:\Users\username\AppData\Local\Programs\Python\Python37-32\Scripts
as a path.
edit: I suspect some problem with the path. So i run the following.
>>> import os
>>> import sys
>>> os.path.dirname(sys.executable)
'C:\\Python25'
it returns: 'C:\\Users\\username\\AppData\\Local\\Microsoft\\WindowsApps\\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0'
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您是否尝试使用
cherrypy
使用c:\ USERS \ USER \用户名\ appdata \ appdata \ local \ program \ python \ python \ python37-32 \ scripts \ scripts \ pip install install install cherrypy install cherrypy
我总是运行
python
并找到正确的python复制它并修改路径,使其进入scripts
然后运行pip pip install install cherrypy
我也注意到了当我安装PY库时,即使它运行,Vscode似乎也无法识别它。要解决此问题,您必须再次重新启动VSCODE,
另一种可能性是您的VSCODE不使用正确的Python版本。要检查左下角的VSCODE,您应该看到您的Python版本。如果Vscode无法识别它,则必须通过Open Command Palette手动输入Python路径
ctrl+shift+shift+p
,然后选择python:select interne> python
然后单击单击输入解释器路径
Have you tried to install
cherrypy
usingC:\Users\username\AppData\Local\Programs\Python\Python37-32\Scripts\pip install cherrypy
When I install py libraries I always run
where python
and find the right python copy it and modify the path so it goes inScripts
then runpip install cherrypy
Also I noticed that when I install py libraries it seems VSCode won't recognize it even though it runs. To fix this you have to restart VSCode again
Another possibility is that your VSCode isn't using correct version of Python. To check this look at VSCode bottom left you should see your python version. If VSCode can't recognize it you will have to enter the Python path manually by Open Command Palette
Ctrl+Shift+P
and choosePython: Select Interpreter
thenclick enter Interpreter path