简体   繁体   English

python 3.9 中的 Tensorflow 安装错误:无法安装 tensorflow [WinError 2]

[英]Tensorflow in python 3.9 Installation error : failure to install tensorflow [WinError 2]

While installing TensorFlow on Windows having python 3.9 installed using the following command:在 Windows 上安装 TensorFlow 时,使用以下命令安装了 python 3.9:

pip install tensorflow

Following error occurred with the warning:出现以下错误并发出警告:

WARNING: Failed to write executable - trying to use .deleteme logic

ERROR: Could not install packages due to an OSError: [WinError 2] 
The system cannot find the file specified: 'c:\\python39\\Scripts\\pyrsa-decrypt.exe'
-> 'c:\\python39\\Scripts\\pyrsa-decrypt.exe.deleteme' 

How this can be resolved?如何解决?

Run the same command using使用运行相同的命令

--user - 用户

pip install --user package_name

or you can try to restart the terminal and run it as admin或者您可以尝试重新启动终端并以管理员身份运行它

Just run the cmd as an administrator then retype the command pip install tensorflow it will take over from where the error occured.只需以管理员身份运行 cmd 然后重新键入命令pip install tensorflow它将从发生错误的位置接管。

What seems to be working for me on Windows Python 3.9 is:在 Windows Python 3.9 上似乎对我有用的是:

pip install --upgrade tensorflow

Just to get it to install without an error.只是为了让它安装没有错误。

As mentioned in the documentation .文档中所述。 Its even working for a non virtual env on my end.它甚至可以为我的非虚拟环境工作。

In my case: When I am running google colab in local runtime jupyter, I tried next command and it worked for me:就我而言:当我在本地运行时 jupyter 中运行 google colab 时,我尝试了下一个命令,它对我有用:

!pip install --user tensorflow

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM