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

时间:2018-12-01 20:02:59

标签: python pip install

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

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的新手,只是一般而言,我真的不知道这些错误是什么意思,而且我在Google上找不到我能理解的任何东西,因此任何帮助都将不胜感激。

这是在Visual Studio代码和python 3.7.1上实现的

1 个答案:

答案 0 :(得分:0)

我知道这会迟到,但我想这会帮助面临类似问题的其他人。

在路径中:

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

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

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