我试图ScientificPython在Fedora 14 x64系统上将软件包安装到新安装的Python发行版中.Pip ScientificPython在存储库中找到但不想安装它
[bin]$ sudo ./python2.7 ./pip search ScientificPython
ScientificPython - Various Python modules for scientific computing
[bin]$ sudo ./python2.7 ./pip install ScientificPython
Downloading/unpacking ScientificPython
Could not find any downloads that satisfy the requirement ScientificPython
No distributions at all found for ScientificPython
Storing complete log in /tmp/tmpDLdmjy
Run Code Online (Sandbox Code Playgroud)
为什么会这样?
谢谢!
我想使用Python的子进程来调用需要将路径作为参数传入的命令行程序。因为这是在 Windows 上,所以路径包含反斜杠。我尝试了很多选项,其中一些选项设置为打印从子进程接收到的路径参数:
转义反斜杠:
>>> cmd = ['f:\\code\\Util.exe', '-i', 'c:\\Users\\paul\\data.xml']
>>> subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
>>> subprocess.communicate()
('Input path: c:\\Users\\paul\\data.xml\n', '...')
Run Code Online (Sandbox Code Playgroud)
单反斜杠,原始格式:
>>> cmd = ['f:\\code\\Util.exe', '-i', r'c:\Users\paul\data.xml']
>>> subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
>>> subprocess.communicate()
('Input path: c:\\Users\\paul\\data.xml\n', '...')
Run Code Online (Sandbox Code Playgroud)
单反斜杠:
>>> cmd = ['f:\\code\\Util.exe', '-i', 'c:\Users\paul\data.xml']
>>> subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
>>> subprocess.communicate()
('Input path: c:\\Users\\paul?5data.xml', '...')
Run Code Online (Sandbox Code Playgroud)
在每种情况下,反斜杠都会作为双反斜杠传递给 Windows 程序。有什么方法可以将单个反斜杠传递给被调用的程序吗?