libtensorflow_io.so在Windows 11上运行Python 3.11时找不到。

huangapple go评论65阅读模式
英文:

libtensorflow_io.so not found when running tensorflow-io on Windows 11 with Python 3.11

问题

> libtensorflow_io.so 未找到

我正在使用x86、Windows 11设置。Python 3.11,tensorflow-io==0.31.0

这是我迄今为止尝试运行的代码:

import os
from matplotlib import pyplot as plt
import tensorflow as tf
import tensorflow_io as tfio

CAPUCHIN_FILE = os.path.join('data','Parsed_Capuchinbird_Clips','XC3776-3.wav')
NOT_CAPUCHIN_FILE = os.path.join('data','Parsed_Not_Capuchinbird_Clips','afternoon-birds-song-in-forest-0.wav')

def load_wav_16k_mono(filename):
    #加载编码的wav文件
    file_contents = tf.io.read_file(filename)
    #解码wav(按通道的张量)
    wav, sample_rate = tf.audio.decode_wav(file_contents, desired_channels=1)
    #去掉尾随轴
    wav = tf.squeeze(wav, axis=-1)
    sample_rate = tf.cast(sample_rate, dtype=tf.int64)
    #从44100Hz转换为16000Hz - 音频信号的振幅
    wav = tfio.audio.resample(wav, rate_in=sample_rate, rate_out=16000)
    return wav

wave = load_wav_16k_mono(CAPUCHIN_FILE)
nwave = load_wav_16k_mono(NOT_CAPUCHIN_FILE)

我收到的错误是:

> NotImplementedError: 无法打开文件:libtensorflow_io.so,来自路径:['C:\Users\bchai\PycharmProjects\AudioML\venv\Lib\site-packages\tensorflow_io\python\ops\libtensorflow_io.so']
由于:['C:\Users\bchai\PycharmProjects\AudioML\venv\Lib\site-packages\tensorflow_io\python\ops\libtensorflow_io.so 未找到']

我尝试将tensorflow-io降级到0.30.0,但也没有帮助。

在线发布的解决此问题的结果涉及安装tensorflow-io版本0.23.1,但对于Python 3.11,它显示找不到分发版。

我考虑安装>= 3.7版本的Python,但在python.org的下载中找不到这些版本。

英文:

> libtensorflow_io.so not found

I am using an x86, windows 11 setup. Python 3.11, tensorflow-io==0.31.0

This is the code I have been trying to run so far:

import os
from matplotlib import pyplot as plt
import tensorflow as tf
import tensorflow_io as tfio

CAPUCHIN_FILE = os.path.join('data','Parsed_Capuchinbird_Clips','XC3776-3.wav')
NOT_CAPUCHIN_FILE = os.path.join('data','Parsed_Not_Capuchinbird_Clips','afternoon-birds-song-in-forest-0.wav')


def load_wav_16k_mono(filename):
    #Load encoded wav file
    file_contents=tf.io.read_file(filename)
    #decode wav(tensors by channels)
    wav,sample_rate=tf.audio.decode_wav(file_contents,desired_channels=1)
    #removes trailing axis
    wav=tf.squeeze(wav,axis=-1)
    sample_rate=tf.cast(sample_rate,dtype=tf.int64)
    #Goes from 44100Hz 6o 16000hz - amplitude of the audio signal
    wav = tfio.audio.resample(wav,rate_in=sample_rate,rate_out=16000)
    return wav

wave = load_wav_16k_mono(CAPUCHIN_FILE)
nwave = load_wav_16k_mono(NOT_CAPUCHIN_FILE)

The error I receive is:

> NotImplementedError: unable to open file: libtensorflow_io.so, from paths: ['C:\Users\bchai\PycharmProjects\AudioML\venv\Lib\site-packages\tensorflow_io\python\ops\libtensorflow_io.so']
caused by: ['C:\Users\bchai\PycharmProjects\AudioML\venv\Lib\site-packages\tensorflow_io\python\ops\libtensorflow_io.so not found']

I tried downgrading tensorflow-io to 0.30.0 that did not help either.

The results posted online for this issue involve installation of tensorflow-io version 0.23.1 but for python 3.11, it says distribution not found.

I thought of installing a >= 3.7 version of python, but those are not available in downloads at python.org.

答案1

得分: 2

存在Python版本冲突。Tensorflow-io的最新版本0.32.0要求python >=3.7且<3.11

请尝试将python版本降级至3.10,并按照此TensorFlow版本兼容性中提到的方式安装tensorflow 2.11以解决此问题。

请参考以下截图:

libtensorflow_io.so在Windows 11上运行Python 3.11时找不到。

英文:

There is python version conflicts. Tensorflow-io latest version 0.32.0 requires python &gt;=3.7 and &lt;3.11.

Please try again by downgrading the python version to 3.10 and install tensorflow 2.11 as mentioned in this TensorFlow Version Compatibility for installing tensorflow-io.

Please check this below screenshot for your reference:

libtensorflow_io.so在Windows 11上运行Python 3.11时找不到。

huangapple
  • 本文由 发表于 2023年5月21日 03:50:48
  • 转载请务必保留本文链接:https://go.coder-hub.com/76297083.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定