本文介绍了为什么pip找不到pysvn?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个用 Python 2 编写的项目,我正在将它升级到 Python 3.到目前为止,我只是发现了一些很容易修复的小语法错误.我所做的是在 Python 3 中创建了一个新项目,确保它可以工作,并将旧项目中的代码块复制到新项目中.

I'm working on a project which was written in Python 2, and I'm upgrading it to Python 3. So far, I've just been finding minor syntax errors which are easily fixable. What I've done is created a new project in Python 3, ensured that it worked, and copies chunks of code from the old project into the new one.

现在,我在使用 pysvn 时遇到了问题.最初,我收到此错误:

Right now, I'm having trouble with pysvn. Initially, I was getting this error:

导入错误:没有名为pysvn"的模块

此时,我尝试使用pip install pysvn,但没有奏效.我得到以下信息:

At this point, I tried using pip install pysvn, which didn't work. I got the following:

pip 安装 pysvn

收集pysvn

找不到满足 pysvn 要求的版本(来自版本:)

Could not find a version that satisfies the requirement pysvn (from versions:)

找不到与 pysvn 匹配的发行版

No matching distribution found for pysvn

然后经过一番研究,我去了 pysvn 下载站点并尝试:

So then after a bit of research, I went to the pysvn download site and tried:

>pip install --index-url http://pysvn.tigris.org/project_downloads.html pysvn,这给了我这个错误:

收集pysvn

位于 pysvn.tigris.org 的存储库不是受信任或安全的主机,因此被忽略.如果此存储库可通过 HTTPS 访问,则建议改用 HTTPS,否则您可以忽略此警告并使用--trusted-host pysvn.tigris.org"允许它.

The repository located at pysvn.tigris.org is not a trusted or secure host and is being ignored. If this repository is available via HTTPS it is recommended to use HTTPS instead, otherwise you may silence this warning and allow it anyways with '--trusted-host pysvn.tigris.org'.

还有与我尝试 >pip install pysvn 时相同的错误.

and also the same error as when I tried >pip install pysvn.

我的下一步是手动下载我需要的版本的 .exe 文件,并且我能够成功安装 pysvn.我检查了 site-packages 目录,pysvn 确实存在,但是 pip 仍然无法告诉我任何有关它的信息:

My next step was to manually download the .exe file for the version I needed, and I was able to successfully install pysvn. I have checked the site-packages directory, and pysvn is indeed there, but pip still can't tell me anything about it:

>pip show pysvn

>

当我为另一个已安装的模块(例如 selenium)执行此操作时,我得到以下信息:

When I do this for another installed module, selenium for example, I get the following:

pip 显示硒

元数据版本:1.1

名称:硒

版本:2.49.2

总结:Selenium 的 Python 绑定

Summary: Python bindings for Selenium

主页:https://github.com/SeleniumHQ/selenium/

作者:未知

作者邮箱:未知

许可证:未知

位置:...\lib\site-packages

Location: ...\lib\site-packages

要求:

我能够验证 pysvn 的安装是否成功,因为我的项目现在运行而不是给我那个 ImportError.

I was able to verify that the installation of pysvn was successful because my project now runs instead of giving me that ImportError.

那么为什么pip不能给我在已成功安装的同一目录中另一个模块的信息?

So why can pip not give me information for another module in the same directory that was successfully installed?

推荐答案

事实证明,因为我没有将 pip install 用于 pysvn,所以 pip 不知道 pysvn 存在.因为它不能从 PyPI(Python 包索引) 获得,所以没有pip 可以看到它的方式(因为这是 pip 首先去寻找它试图安装的包的地方).

As it turns out, because I didn't use pip install for pysvn, pip didn't know that pysvn existed. Because it wasn't available from PyPI (the Python Package Index), there was no way that pip could see it (because that's where pip goes first to find packages that it's attempting to install).

来自 pip 用户指南:

pip 支持从 PyPI、版本控制、本地项目和直接从分发文件安装.

因为我最终从 自己的下载站点下载了 pysvn(这不是上述 4 个选项中的任何一个)并手动运行 .exe,pip 根本不知道它即使它与 pip 安装的其他软件包位于同一目录中.

Since I had eventually downloaded pysvn from its own download site (which was not any of the above 4 options) and ran the .exe manually, pip simply doesn't know about it even though it's in the same directory as other packages installed by pip.

我想我也可以检索分发文件并将 pip 与这些文件一起使用,但我的解决方法成功了.

I suppose I could've also retrieved the distribution files and used pip with those, but my workaround did the trick.

这篇关于为什么pip找不到pysvn?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-13 01:21