小编zes*_*t16的帖子

使用 pyenv 安装 Python 3.10.5

我想安装 Python 3.10.5(或至少 Python >= 3.7)。我按照以下说明操作:

# Step 1. Install pyenv

git clone https://github.com/pyenv/pyenv.git ~/.pyenv
echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.bashrc
echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.bashrc
echo -e 'if command -v pyenv 1>/dev/null 2>&1; then\n  eval "$(pyenv init -)"\nfi' >> ~/.bashrc

# Step 2. Install missing headers for all the Python modules to be built

sudo zypper install readline-devel sqlite3-devel libbz2-devel

# Step 3. Install the desired Python version

pyenv install 3.10.5
Run Code Online (Sandbox Code Playgroud)

直到我到达pyenv install 3.10.5

bscuser@localhost:~> pyenv …
Run Code Online (Sandbox Code Playgroud)

python pyenv virtual-environment python-3.10

10
推荐指数
3
解决办法
3万
查看次数

TFBertForSequenceClassification 需要 TensorFlow 库,但在您的环境中未找到

这:

import tensorflow as tf
from transformers import BertTokenizer, TFBertForSequenceClassification

model = TFBertForSequenceClassification.from_pretrained("bert-base-uncased")
Run Code Online (Sandbox Code Playgroud)

输出以下错误:

ImportError: 
TFBertForSequenceClassification requires the TensorFlow library but it was not found in your environment. Checkout the instructions on the
installation page: https://www.tensorflow.org/install and follow the ones that match your environment.
Run Code Online (Sandbox Code Playgroud)

然而,事实并非如此,我没有导入 TensorFlow 库。

> print(tf.__version__)
'2.7.0'
Run Code Online (Sandbox Code Playgroud)

python installation tensorflow huggingface-transformers

5
推荐指数
1
解决办法
6864
查看次数