简体   繁体   English

VS代码和Python-安装后的问题(路径)

[英]VS Code and Python - Problem after installation (Path)

I'm planning to start learning Python and I have just installed it on my laptop. 我打算开始学习Python,并且刚刚将其安装在笔记本电脑上。

Python 3.7.1 -> D:/Python/Python37 Python 3.7.1-> D:/ Python / Python37

VS Code -> D:/Microsoft VS Code VS代码-> D:/ Microsoft VS代码

I have also added the Python Microsoft extension within VS Code. 我还在VS Code中添加了Python Microsoft扩展。

I'm trying to run the simplest function: 我正在尝试运行最简单的功能:

print ("Hello World!")

I do not understand why it returns me: 我不明白为什么它会返回我:

PS C:\\Users\\raduf\\OneDrive\\Desktop\\Python> cd 'C:\\Users\\raduf\\OneDrive\\Desktop\\Python'; PS C:\\ Users \\ raduf \\ OneDrive \\ Desktop \\ Python> cd'C:\\ Users \\ raduf \\ OneDrive \\ Desktop \\ Python'; ${env:PYTHONIOENCODING}='UTF-8'; $ {ENV:PYTHONIOENCODING} = 'UTF-8'; ${env:PYTHONUNBUFFERED}='1'; $ {ENV:PYTHONUNBUFFERED} = '1'; & 'D:/Python/Python37/python.exe' 'c:\\Users\\raduf.vscode\\extensions\\ms-python.python-2018.11.0\\pythonFiles\\experimental\\ptvsd_launcher.py' '--default' '--client' '--host' 'localhost' '--port' '52090' 'c:\\Users\\raduf\\OneDrive\\Desktop\\Python\\hello.py' Hello World &'D:/Python/Python37/python.exe''c:\\ Users \\ raduf.vscode \\ extensions \\ ms-python.python-2018.11.0 \\ pythonFiles \\ experimental \\ ptvsd_launcher.py''--default''- -client''--host''localhost''--port''52090''c:\\ Users \\ raduf \\ OneDrive \\ Desktop \\ Python \\ hello.py'Hello World

Why does it have to "cd" first that entire path? 为什么必须先“ cd”整个路径? Any help is welcome! 欢迎任何帮助!

Did you move the runtime files after installing them? 安装后是否移动了运行时文件?

It looks like you are trying to run the things out of a local synced One Drive folder. 看来您正在尝试从本地同步的“一个驱动器”文件夹中运行内容。 Was the Python runtime also installed to that location? Python运行时是否也已安装到该位置?

In any case: your program works. 无论如何:您的程序有效。 The output you see is the command necessary to execute your program followed by its output, "Hello World" (without the quotes). 您看到的输出是执行程序所必需的命令,其后是输出“ Hello World”(不带引号)。

I am not sure about the CD part, but with the exception of the funky location, it looks to me like it's working as expected. 我不确定CD的一部分,但是除了时髦的位置,在我看来它像预期的那样工作。 :-) :-)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM