由于环境错误而无法安装软件包:[Errno 2] 没有这样的文件或目录

问题描述 投票:0回答:2

这就是我用来安装软件包的方法,唯一有效的是 requests

pip._internal.main(['install', 'requests'])
pip._internal.main(['install', 'lxml'])
pip._internal.main(['install', 'cssselect'])
pip._internal.main(['install', 'selenium'])

这是我在控制台中收到的错误消息

Requirement already satisfied: requests in c:\users\user\appdata\local\programs\python\python37-32\lib\site-packages (2.20.1)
Requirement already satisfied: chardet<3.1.0,>=3.0.2 in c:\users\user\appdata\local\programs\python\python37-32\lib\site-packages (from requests) (3.0.4)
Requirement already satisfied: certifi>=2017.4.17 in c:\users\user\appdata\local\programs\python\python37-32\lib\site-packages (from requests) (2018.11.29)
Requirement already satisfied: urllib3<1.25,>=1.21.1 in c:\users\user\appdata\local\programs\python\python37-32\lib\site-packages (from requests) (1.24.1)
Requirement already satisfied: idna<2.8,>=2.5 in c:\users\user\appdata\local\programs\python\python37-32\lib\site-packages (from requests) (2.7)
Collecting lxml
  Using cached https://files.pythonhosted.org/packages/43/c7/e088bf0f4f81e6b366cc2de12939c559b588b9525ad76215d122e69151ed/lxml-4.2.5-cp37-cp37m-win32.whl
Could not install packages due to an EnvironmentError: [Errno 2] No such file or directory: 'C:\\Users\\user\\AppData\\Local\\Temp\\pip-req-tracker-047sxufq\\9dca403282533c33ca73fe9ecbdb1b605aeffa273ec0704ef517f834'

Collecting cssselect
  Using cached https://files.pythonhosted.org/packages/7b/44/25b7283e50585f0b4156960691d951b05d061abf4a714078393e51929b30/cssselect-1.0.3-py2.py3-none-any.whl
Could not install packages due to an EnvironmentError: [Errno 2] No such file or directory: 'C:\\Users\\user\\AppData\\Local\\Temp\\pip-req-tracker-047sxufq\\e5cecb9a9f004e9bd84aa92925e0dc6e8458127d14eb08f37c4e2d0f'

Collecting selenium
  Using cached https://files.pythonhosted.org/packages/80/d6/4294f0b4bce4de0abf13e17190289f9d0613b0a44e5dd6a7f5ca98459853/selenium-3.141.0-py2.py3-none-any.whl
Could not install packages due to an EnvironmentError: [Errno 2] No such file or directory: 'C:\\Users\\user\\AppData\\Local\\Temp\\pip-req-tracker-047sxufq\\b3025a26893a7657747ef91c7e8a7d138021b8a645639c56cd0046c5'

我对Python相当陌生,只是一般性地编码,我真的不知道这些错误意味着什么,而且我在谷歌上找不到我理解的任何内容,所以任何帮助都将不胜感激。

这是在 Visual Studio 代码和 Python 3.7.1 中

python pip installation
2个回答
0
投票

我知道这已经晚了,但我想这会帮助其他面临类似问题的人。

在路径中:

C:\\Users\\user\\AppData\\Local\\Temp\\pip-req-tracker-047sxufq\\b3025a26893a7657747ef91c7e8a7d138021b8a645639c56cd0046c5

"AppData"
文件夹及其内容可能被 Windows 标记为
"Hidden"
和/或
"Read only"
,取消勾选这些并将它们指定为普通文件夹可能会有所帮助。

这是唯一帮助我的解决方案。请尝试一下并发表评论。


0
投票

他的回答对我有用https://stackoverflow.com/users/15757753/abhishek-v

考虑到我的 AppData 为 90 GB,大约需要 50 分钟才能取消隐藏所有内容,但效果非常好。

© www.soinside.com 2019 - 2024. All rights reserved.