简体   繁体   English

非常基本的Python 2.7.13在IDLE和python中打开文件时遇到问题

[英]Very Basic Python 2.7.13 Trouble opening files in IDLE and python

took a break from programming and am trying to get an old program up and running. 编程休息了一段时间,正在尝试启动并运行旧程序。 I previously wrote a program called 'NetsimGUI' that uses modules networkx and matplotlib. 我之前编写了一个名为“ NetsimGUI”的程序,该程序使用模块networkx和matplotlib。 I could not figure out how to install them on a new computer (running Windows 10) and then realized I could barely do anything at all. 我不知道如何在新计算机(运行Windows 10)上安装它们,然后意识到我几乎什么也做不了。 In the Python command window after importing pip I have tried the following: 导入pip之后,在Python命令窗口中,我尝试了以下操作:

'python pip install networkx'

'pip install networkx'

'python NetsimGUI'

'python NetsimGUI.py'

'Python NetsimGUI.py'

'Python27 NetsimGUI.py'

'NetsimGUI.py'

'NetsimGUI'

'python -m pip install -U pip'

'python -v'

'py27 -v'

'py -27 -v'

'Python -v'

and so on. 等等。 All give errors saying NameError: name 'python' or name 'py' is not defined or something similar. 所有人都给出错误,提示NameError:未定义名称“ python”或名称“ py”或类似名称。 PATH environment variable is set to C:\\Python27 and NetsimGUI.py is in that folder as well. PATH环境变量设置为C:\\ Python27,NetsimGUI.py也位于该文件夹中。 Guessing the solution is something super simple I am missing. 我猜不到解决方案是一件非常简单的事情。 Any ideas? 有任何想法吗?

It looks like you're basically having trouble installing pip on Windows. 看来您基本上无法在Windows上安装pip。 What you're doing isn't exactly correct, the correctly way to install pip 2.7 on Windows is detailed here 您所做的工作并不完全正确, 此处详细介绍在Windows上安装pip 2.7的正确方法

From the docs: 从文档:

To install pip, securely download get-pip.py . 要安装pip,请安全下载get-pip.py

Then run the following: 然后运行以下命令:

python get-pip.py

Once you've done that, you should be able to install python modules as normal. 完成此操作后,您应该能够正常安装python模块。

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

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