我正在尝试为Python 3.5安装一些软件包(pyodbc,pandas),但这个过程正在陷入困境。我尝试的第一件事是:
C:\Program Files (x86)\Python 3.5\Scripts> pip install pyodbc
这给了我以下
Traceback (most recent call last):
File "C:\Program Files (x86)\Python 3.5\Scripts\pip-script.py", line 9, in <module> load_entry_point('pip==8.1.2', 'console_scripts', 'pip')()
File "C:\Program Files (x86)\Python 3.5\lib\site-packages\pkg_resources\__init__.py", line 552, in load_entry_point return get_distribution(dist).load_entry_point(group, name)
File "C:\Program Files (x86)\Python 3.5\lib\site-packages\pkg_resources\__init__.py", line 2672, in load_entry_point
return ep.load()
File "C:\Program Files (x86)\Python 3.5\lib\site-packages\pkg_resources\__init__.py", line 2345, in load return self.resolve()
File "C:\Program Files (x86)\Python 3.5\lib\site-packages\pkg_resources\__init__.py", line 2351, in resolve
module = __import__(self.module_name, fromlist=['__name__'], level=0)
File "C:\Program Files (x86)\Python 3.5\lib\site-packages\pip-8.1.2-py3.5.egg\pip\__init__.py", line 14, in <module>
from pip.utils import get_installed_distributions, get_prog
File "C:\Program Files (x86)\Python 3.5\lib\site-packages\pip-8.1.2-py3.5.egg\pip\utils\__init__.py", line 27, in <module>
from pip._vendor import pkg_resources
ImportError: cannot import name 'pkg_resources'
然后我尝试
C:\Program Files (x86)\Python 3.5\Scripts> pip install pkg_resources
产生相同的pkg_resources错误。
接下来我尝试
C:\Program Files (x86)\Python 3.5\Scripts> easy_install-3.5 install pkg_resources
和
C:\Program Files (x86)\Python 3.5\Scripts> easy_install-3.5 pkg_resources
两者都产生
Searching for pkg-resources
Reading https://pypi.python.org/simple/pkg_resources/
No local packages or download links found for pkg-resources error: Could not find suitable distribution for Requirement.parse('pkg-resources')
进一步搜索后,有人建议setuptools可能已过期。目前我有16.0的setuptools,而我看到的最新版本是25.1.6。当我尝试使用pip更新setuptools时,
C:\Program Files (x86)\Python 3.5\Scripts> pip install -U setuptools
我再次收到pkg_resources错误。如果我使用easy_install-3.5进行更新,它会再次安装16.0版本。
接下来,我尝试通过下载.whl文件手动安装setuptools。
C:\Program Files (x86)\Python 3.5\Scripts>pip install "C:\Users\xxxx\Downloads\setuptools-25.1.6-py2.py3-none-any.whl"
但是再次出现了pkg_resources错误。
由于我的目标是简单地安装软件包,我还尝试了
C:\Program Files (x86)\Python 3.5\Scripts> easy_install-3.5 install pyodbc
如上所述,它提供相同的No Local包或下载链接错误。相反,如果我运行
C:\Program Files (x86)\Python 3.5\Scripts> easy_install-3.5 pyodbc
我得到了
C:\Program Files (x86)\Python 3.5\Scripts>easy_install-3.5 pyodbc
Searching for pyodbc
Reading https://pypi.python.org/simple/pyodbc/
Best match: pyodbc 3.0.10
Downloading https://pypi.python.org/packages/9c/6f/27ffd47f56226e572bb8cf06a8355d8ed875b49b8317e73a95c20fb599d1/pyodbc-3.0.10.tar.gz#md5=3f6f205c979a0fe5dee05d37121a7b92
Processing pyodbc-3.0.10.tar.gz
Writing C:\Users\xxxx\AppData\Local\Temp\easy_install-97z1da15\pyodbc-3.0.10\setup.cfg
Running pyodbc-3.0.10\setup.py -q bdist_egg --dist-dir C:\Users\xxxx\AppData\Local\Temp\easy_install-97z1da15\pyodbc-3.0.10\egg-dist-tmp-00jdn31z
error: [WinError 32] The process cannot access the file because it is being used by another process: 'C:\\Users\\xxxxx\\AppData\\Local\\Temp\\easy_install-97z1da15\\pyodbc-3.0.10\\pyodbc.egg-info\\SOURCES.txt'
有什么想法吗?