简体   繁体   English

Python 3.6:在 Windows 上安装 tensorflow 失败,出现 TypeError:stat:path should be string, bytes, os.PathLike or integer, not NoneType

[英]Python 3.6: tensorflow install on windows failed with TypeError: stat: path should be string, bytes, os.PathLike or integer, not NoneType

I am new to Python and Tensorflow.我是 Python 和 Tensorflow 的新手。 I tried to install tensorflow using the command pip install --upgrade tensorflow.我尝试使用命令 pip install --upgrade tensorflow 安装 tensorflow。 However, the installation fails at two points:但是,安装在两点失败:

  1. Building wheel for wrapt (setup.py) wrapt 的构建轮 (setup.py)
  2. Running setup.py install for wrapt为 wrapt 运行 setup.py install

During both these instances, the error is the same在这两种情况下,错误是相同的

TypeError: stat: path should be string, bytes, os.PathLike or integer, not NoneType

Can anybody suggest some solution for this error?有人可以针对此错误提出一些解决方案吗?

I had same failure, tried older Python, older TensorFlow but no luck.我有同样的失败,尝试过旧的 Python,旧的 TensorFlow 但没有运气。 Then fell upon this and it works for me (I'm on Windows).然后发现了这个,它对我有用(我在 Windows 上)。 Make sure you do the following:请确保执行以下操作:

set WRAPT_INSTALL_EXTENSIONS=false

before running having pip install tensorflow .在运行pip install tensorflow之前。

Hope this helps!希望这可以帮助!

set WRAPT_INSTALL_EXTENSIONS=false

Worked for me, but I had to run it from a command window, not powershell.为我工作,但我必须从命令窗口而不是 powershell 运行它。

I wasted a lot of time troubleshooting this, but for me the root cause was that Microsoft Visual C++ Redistributable wasn't installed.我浪费了很多时间对此进行故障排除,但对我来说根本原因是未安装Microsoft Visual C++ Redistributable (or the latest version) (或最新版本)

The install script built the path of a dll in this package based on where it's supposed to be and one util function returns the path if it exists and None if it doesn't.安装脚本根据它应该在的位置在这个包中构建一个 dll 的路径,如果它存在,一个 util 函数返回路径,如果不存在,则返回 None 。 The next util function will break with the above mentioned error if the dll doesn't exist and the previous function returned None.如果 dll 不存在并且前一个函数返回 None,则下一个 util 函数将因上述错误而中断。 ( genericpath.py and msvc.py ) (通用msvc.py genericpath.py

This error seems to be a symptom of another problem, which is the root cause.这个错误似乎是另一个问题的症状,这是根本原因。 (missing C++ redistributable in my case). (在我的例子中缺少 C++ 可再发行组件)。 If you are feeling adventurous you can take a look at the stack trace and see who is calling the function with None.如果你喜欢冒险,你可以查看堆栈跟踪,看看谁在调用 None 函数。 You might be able to add a few print s and see what is the root cause for you.您可以添加一些print并查看根本原因是什么。

Took me hours to find this page finally as a solution.我花了几个小时终于找到这个页面作为解决方案。 I tried everything, reinstall different versions of python, cleaning up my pc, etc. @AdamColton, you're a genius.我尝试了一切,重新安装了不同版本的 python,清理了我的电脑,等等。@AdamColton,你是个天才。 Installation worked for me with tensorflow 2.0.0 and python 3.6.8 like a charm with this line of code before.使用 tensorflow 2.0.0 和 python 3.6.8 安装对我来说很有效,就像之前这行代码的魅力一样。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 PubNub: TypeError: stat: path 应该是字符串、字节、os.PathLike 或整数,而不是 NoneType - PubNub: TypeError: stat: path should be string, bytes, os.PathLike or integer, not NoneType Python TypeError: stat: path should be string, bytes, os.PathLike or integer, not list - Python TypeError: stat: path should be string, bytes, os.PathLike or integer, not list pip install django mysqlclient 'path should be string, bytes, os.PathLike or integer, not NoneType' on windows - pip install django mysqlclient 'path should be string, bytes, os.PathLike or integer, not NoneType' on windows os.stat(path) TypeError: stat: path should be string, bytes, os.PathLike or integer, not Entry - os.stat(path) TypeError: stat: path should be string, bytes, os.PathLike or integer, not Entry stat:路径应该是字符串、字节、os.PathLike 或 integer,而不是 NoneType - refextract - stat: path should be string, bytes, os.PathLike or integer, not NoneType - refextract TypeError:stat:路径应为字符串,字节,os.PathLike或整数,而不是_io.TextIOWrapper - TypeError: stat: path should be string, bytes, os.PathLike or integer, not _io.TextIOWrapper 为什么会出现“stat: path should be string, bytes, os.PathLike or integer, not tuple”类型错误? - Why do I get “ stat: path should be string, bytes, os.PathLike or integer, not tuple” type error? TypeError: startfile: 文件路径应该是字符串、字节或 os.PathLike,而不是列表 - TypeError: startfile: filepath should be string, bytes or os.PathLike, not list TypeError:listdir:路径应该是字符串、字节、os.PathLike 或 None,而不是 DirectoryIterator - TypeError: listdir: path should be string, bytes, os.PathLike or None, not DirectoryIterator 创建目录时“类型错误:路径应该是字符串、字节或 os.PathLike,而不是列表” - "TypeError:path should be string, bytes or os.PathLike, not list" while creating directory
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM