gpt4 book ai didi

Python pip 无法找到 pyodbc

转载 作者:IT老高 更新时间:2023-10-28 22:06:37 24 4
gpt4 key购买 nike

使用 virtualenv 并尝试安装 pyodbc。我能找到的所有资源都声称这应该非常简单。在 MySQL 等的所有基本安装之后,只需执行以下操作:

pip install pyodbc

但是,我看到一个非常奇怪的错误。它与缺少库无关(据我所知),在谷歌搜索这种错误很长时间后,我根本找不到任何有建设性的东西。

(local-dev)espears@espears-w ~ $ pip install pyodbc
Downloading/unpacking pyodbc
Could not find any downloads that satisfy the requirement pyodbc
Some externally hosted files were ignored (use --allow-external pyodbc to allow).
Cleaning up...
No distributions at all found for pyodbc
Storing debug log for failure in /home/espears/.pip/pip.log

所以我尝试了“允许外部”选项,但没有帮助:

(local-dev)espears@espears-w ~ $ pip install --allow-external pyodbc
You must give at least one requirement to install (see "pip help install")

但帮助文档显示我正确使用了此选项,例如从运行 pip help install 的输出:

Package Index Options:

...

--allow-external <package> Allow the installation of externally hosted files

这是 PIP 日志文件中的结果:

(local-dev)espears@espears-w ~ $ cat /home/espears/.pip/pip.log
Downloading/unpacking pyodbc
Getting page https://pypi.python.org/simple/pyodbc/
URLs to search for versions for pyodbc:
* https://pypi.python.org/simple/pyodbc/
Analyzing links from page https://pypi.python.org/simple/pyodbc/
Skipping link http://code.google.com/p/pyodbc (from https://pypi.python.org/simple/pyodbc/); not a file
Skipping link http://code.google.com/p/pyodbc/downloads/list (from https://pypi.python.org/simple/pyodbc/); not a file
Not searching http://code.google.com/p/pyodbc (from https://pypi.python.org/simple/pyodbc/) for files because external urls are disallowed.
Not searching http://code.google.com/p/pyodbc (from https://pypi.python.org/simple/pyodbc/) for files because external urls are disallowed.
Not searching http://code.google.com/p/pyodbc (from https://pypi.python.org/simple/pyodbc/) for files because external urls are disallowed.
Not searching http://code.google.com/p/pyodbc (from https://pypi.python.org/simple/pyodbc/) for files because external urls are disallowed.
Not searching http://code.google.com/p/pyodbc (from https://pypi.python.org/simple/pyodbc/) for files because external urls are disallowed.
Not searching http://code.google.com/p/pyodbc (from https://pypi.python.org/simple/pyodbc/) for files because external urls are disallowed.
Not searching http://code.google.com/p/pyodbc (from https://pypi.python.org/simple/pyodbc/) for files because external urls are disallowed.
Not searching http://code.google.com/p/pyodbc (from https://pypi.python.org/simple/pyodbc/) for files because external urls are disallowed.
Not searching http://code.google.com/p/pyodbc (from https://pypi.python.org/simple/pyodbc/) for files because external urls are disallowed.
Not searching http://code.google.com/p/pyodbc (from https://pypi.python.org/simple/pyodbc/) for files because external urls are disallowed.
Not searching http://code.google.com/p/pyodbc (from https://pypi.python.org/simple/pyodbc/) for files because external urls are disallowed.
Not searching http://code.google.com/p/pyodbc (from https://pypi.python.org/simple/pyodbc/) for files because external urls are disallowed.
Not searching http://code.google.com/p/pyodbc/downloads/list (from https://pypi.python.org/simple/pyodbc/) for files because external urls are disallowed.
Not searching http://code.google.com/p/pyodbc/downloads/list (from https://pypi.python.org/simple/pyodbc/) for files because external urls are disallowed.
Not searching http://code.google.com/p/pyodbc/downloads/list (from https://pypi.python.org/simple/pyodbc/) for files because external urls are disallowed.
Not searching http://code.google.com/p/pyodbc/downloads/list (from https://pypi.python.org/simple/pyodbc/) for files because external urls are disallowed.
Not searching http://code.google.com/p/pyodbc/downloads/list (from https://pypi.python.org/simple/pyodbc/) for files because external urls are disallowed.
Not searching http://code.google.com/p/pyodbc/downloads/list (from https://pypi.python.org/simple/pyodbc/) for files because external urls are disallowed.
Not searching http://code.google.com/p/pyodbc/downloads/list (from https://pypi.python.org/simple/pyodbc/) for files because external urls are disallowed.
Not searching http://code.google.com/p/pyodbc/downloads/list (from https://pypi.python.org/simple/pyodbc/) for files because external urls are disallowed.
Not searching http://code.google.com/p/pyodbc/downloads/list (from https://pypi.python.org/simple/pyodbc/) for files because external urls are disallowed.
Not searching http://code.google.com/p/pyodbc/downloads/list (from https://pypi.python.org/simple/pyodbc/) for files because external urls are disallowed.
Not searching http://code.google.com/p/pyodbc/downloads/list (from https://pypi.python.org/simple/pyodbc/) for files because external urls are disallowed.
Not searching http://code.google.com/p/pyodbc/downloads/list (from https://pypi.python.org/simple/pyodbc/) for files because external urls are disallowed.
Could not find any downloads that satisfy the requirement pyodbc
Some externally hosted files were ignored (use --allow-external pyodbc to allow).
Cleaning up...
Removing temporary dir /home/espears/.virtualenvs/local-dev/build...
No distributions at all found for pyodbc
Exception information:
Traceback (most recent call last):
File "/home/espears/.virtualenvs/local-dev/local/lib/python2.7/site-packages/pip/basecommand.py", line 122, in main
status = self.run(options, args)
File "/home/espears/.virtualenvs/local-dev/local/lib/python2.7/site-packages/pip/commands/install.py", line 270, in run
requirement_set.prepare_files(finder, force_root_egg_info=self.bundle, bundle=self.bundle)
File "/home/espears/.virtualenvs/local-dev/local/lib/python2.7/site-packages/pip/req.py", line 1157, in prepare_files
url = finder.find_requirement(req_to_install, upgrade=self.upgrade)
File "/home/espears/.virtualenvs/local-dev/local/lib/python2.7/site-packages/pip/index.py", line 285, in find_requirement
raise DistributionNotFound('No distributions at all found for %s' % req)
DistributionNotFound: No distributions at all found for pyodbc

看起来如果我可以让 --allow-external 选项起作用,它就会起作用,因为它清楚地看到了获取 pyodbc 的常用位置。

但我很困惑为什么需要这样做,因为几乎所有关于安装 pyodbc 的引用都不需要特意启用外部链接。我今天一整天都在安装许多软件包,几乎没有问题,而且在任何其他情况下肯定不会遇到这种 allow-external 需求。

我在 Ubuntu 12.04 上使用 pip 版本 1.5 和 Python 2.7.3。

最佳答案

如果 PyPI 目录结构正确,运行 pip install --allow-external pyodbc --allow-unverified pyodbc pyodbc 将起作用。

根据我最初发布此答案时的 pip.log 输出,我认为该包的网站目录结构已损坏。您始终可以通过指定包的 URL 来解决此类问题,例如 pip install https://storage.googleapis.com/google-code-archive-downloads/v2/code.google.com/pyodbc/pyodbc-3.0.7.zip,不同版本的链接描述here .

关于Python pip 无法找到 pyodbc,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21054656/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com