首页 > 解决方案 > pip install tensorflowjs 时出错 — 由于 EnvironmentError 无法安装软件包:[Errno 2] 没有这样的文件或目录:

问题描述

安装tensorflowjs的时候出错,安装其他包没问题,只是这个包失败了。

我试图 pip install --user pyspider,失败了。我升级了pip版本,仍然失败。我首先安装了 tf_nightly 模块并运行“pip install tensorflowjs”,但仍然失败。

C:\Users\Jingyi>pip install tensorflowjs
Collecting tensorflowjs
  Using cached https://files.pythonhosted.org/packages/79/29/35e1aa467436ff46b98df65a08c49faaedb3429e1c512d1d90fe308040a0/tensorflowjs-1.0.1-py3-none-any.whl
Collecting numpy==1.15.1 (from tensorflowjs)
  Using cached https://files.pythonhosted.org/packages/fb/7d/f8b97d97809f184d90faf320fa8e2e7eac994844c5e6c57adbed1283e9e9/numpy-1.15.1-cp36-none-win_amd64.whl
Collecting six==1.11.0 (from tensorflowjs)
  Using cached https://files.pythonhosted.org/packages/67/4b/141a581104b1f6397bfa78ac9d43d8ad29a7ca43ea90a2d863fe3056e86a/six-1.11.0-py2.py3-none-any.whl
Collecting tf-nightly-2.0-preview>=2.0.0.dev20190304 (from tensorflowjs)
  Using cached https://files.pythonhosted.org/packages/4c/13/8fa7c91176d299759487d90ab201256941b43a48ecbf033a2a726f4dafce/tf_nightly_2.0_preview-2.0.0.dev20190509-cp36-cp36m-win_amd64.whl
ERROR: Could not install packages due to an EnvironmentError: [Errno 2] No such file or directory: 'C:\\Users\\Jingyi\\AppData\\Local\\Temp\\pip-install-4ytziwpr\\tf-nightly-2.0-preview\\tf_nightly_2.0_preview-2.0.0.dev20190509.data/purelib/tensorflow/include/tensorflow/include/external/eigen_archive/unsupported/Eigen/CXX11/src/Tensor/TensorSyclConvertToDeviceExpression.h'

我希望成功安装 tensorflowjs。

标签: pipinstallationtensorflow.js

解决方案


这是由windows路径长度限制引起的,您可以尝试以下方法:

  1. 点击 Windows 键,键入gpedit.msc并按 Enter。
  2. 导航到Local Computer Policy > Computer Configuration > Administrative Templates > System > Filesystem
  3. 双击该Enable Win32 long paths选项并启用它。
  4. 然后重启电脑就可以了

原始答案在这里


推荐阅读