尽管我刚刚安装了它,但在Visual Studio代码中找不到错误

发布于 2025-02-01 11:35:46 字数 671 浏览 3 评论 0原文

我想使用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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

朕就是辣么酷 2025-02-08 11:35:46

您是否尝试使用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 using C:\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 in Scripts then run pip 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 choose Python: Select Interpreter then click enter Interpreter path

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文