Visual Studio Professional 2015和Python ...... [英] Visual Studio Professional 2015 and Python...

查看:128
本文介绍了Visual Studio Professional 2015和Python ......的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好, 



学习使用Visual Studio 2015 Professional编写一些Python代码


到目前为止,我已成功完成以下操作


- 下载Python工具


- 安装Python应用程序



有一件事我注意到Visual Studio没有自动检测Python环境,所以我不得不手动指向目录(python exe,python lib等)



我能成功做的是运行一个程序,所以例如print('hello world')在我按下start时可以正常工作。但是有两件事没有按预期工作



1 - 我经常得到一个"完成数据库不是最新的。点击开始刷新"在"Python环境"下的visual studio的右上角


刷新可能会卡住1/5,它只会回到那个通知



2-"打印"关键词没有被识别为关键词(蓝色)它只是像普通文本一样白色,即使Visual Studio知道如何处理它。 



奇怪的是,如果我删除手动添加的环境,关键字会回到蓝色,但显然Visual Studio不知道如何编译。 



希望我所说的有道理,我已经看到了一些类似的问题报道,但没有具体说明我遇到的问题。 

解决方案

嗨adodd81802


< span style ="line-height:107%; font-family:'Segoe UI',sans-serif; background:white">欢迎来到MSDN论坛。



Hello, 

Learning to code some Python using Visual Studio 2015 Professional

So far I have successfully done the following

- Downloaded the Python Tools

- Installed the Python Application

One thing I noticed was that Visual Studio didn't automatically detect the Python Environment, so I had to manually point to the directory (python exe, python lib e.t.c.)

What I can successfully do is run a program, so for example print('hello world') does work when I press start. But there are 2 things that are not working as expected

1 - I've constantly got a "Completion DB is not up to date. Click to start refreshing" in the top right of visual studio under the "Python Environments"

Refreshing gets stuck maybe 1/5th of the way and it just goes back to that notification

2- The "Print" key word is not getting recognised as a keyword (in blue) it's just in white like normal text, even though Visual Studio knows what to do with it. 

Weirdly, if I remove the environment that I manually added, the keyword goes back to the blue, but obviously then Visual Studio doesn't know how to compile. 

Hope what i've said makes sense, I've seen some similar issues reported, but not specifically the problem I'm having. 

解决方案

Hi adodd81802

Welcome to the MSDN forum.

  • Once Visual Studio setup is complete, install a Python interpreter of your choice. Visual Studio 2015 supports only Python 3.5 and earlier; later versions generate a message like Unsupported Python version 3.6). If you already have an interpreter installed and Visual Studio doesn't detect it automatically, see Manually identify an existing environment.
  • By default Visual Studio will not set the environment of Python

How did you install PTVS in VS? in my view, you need to check the "python tool for Visual Studio" by modifying VS 2015 in "program and feature". As the screenshot I shown below and check this Docs: https://docs.microsoft.com/en-us/visualstudio/python/installing-python-support-in-visual-studio?view=vs-2017#visual-studio-2015 :

Could you share more info about which environment did you add to python environment? (share screenshots is better). And what did you mean that installed a python app? What’s version of PTVS installed?  what’s your project type?

Please create a new python project via file – new – project/solution –python – choose "python application" template to test. I tried to repro your issue, and in my side, the "print" as a keyword is displayed. So if you cannot see this, you’d better check update flag in upper right of IDE to update VS and open "program and feature" to right click "modify" - "repair" to repair VS.

Besides, I find a similar thread: https://github.com/Microsoft/PTVS/issues/1439 and https://github.com/Microsoft/PTVS/issues/1085 . the error is related to python. Since our forum mainly focus on VS IDE issue. If the thread could not solve your question, I suggest you redirect to the Github python forum to start a new thread with this info for a better supporting.

Thank you for your understanding.

Br

May


这篇关于Visual Studio Professional 2015和Python ......的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆