如何正确地将numpy 1.24.2替换为1.23.5

xcitsw88  于 2023-04-06  发布在  其他
关注(0)|答案(2)|浏览(395)

你能告诉我如何在Ubuntu 20.04上安装旧版本的numpy 1.23.5吗,因为我收到了这个错误:

$ pip3 install numpy==1.23.5
Collecting numpy==1.23.5
  Using cached numpy-1.23.5-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (17.1 MB)
ERROR: tensorflow 2.12.0 has requirement protobuf!=4.21.0,!=4.21.1,!=4.21.2,!=4.21.3,!=4.21.4,!=4.21.5,<5.0.0dev,>=3.20.3, but you'll have protobuf 3.6.1 which is incompatible.
ERROR: tensorboard 2.12.0 has requirement protobuf>=3.19.6, but you'll have protobuf 3.6.1 which is incompatible.
ERROR: pandas 1.5.3 has requirement python-dateutil>=2.8.1, but you'll have python-dateutil 2.7.3 which is incompatible.
ERROR: pandas 1.5.3 has requirement pytz>=2020.1, but you'll have pytz 2019.3 which is incompatible.
Installing collected packages: numpy
Successfully installed numpy-1.24.2

每当我尝试卸载旧版本时,我得到:

$ sudo pip uninstall numpy
Found existing installation: numpy 1.17.4
Not uninstalling numpy at /usr/lib/python3/dist-packages, outside environment /usr
Can't uninstall 'numpy'. No files were found to uninstall.
owfi6suc

owfi6suc1#

看起来你的软件包中有一些冲突。我会先创建一个新的env来做这件事。如果你想使用当前的env,你应该卸载所有冲突的软件包(即pandas, tensorflow, tensorboard, numpy),而不仅仅是安装想要的numpy版本

lp0sw83n

lp0sw83n2#

我已经解决了这个问题如下:

sudo rm -rf /home/$USER/.local/lib/python3.8/site-packages/numpy*

pip3 install numpy==1.23.5

相关问题