Pip3 安装不安装 numpy 模块



通过常规方式(即sudo -H pip3 install --user numpy==1.17( 不允许使用该模块。

导入 numpy 是不可能的,也没有列在 pip3 冻结中

为了解决这个问题,我使用sudo -E pip3 install --upgrade numpy然后允许我使用该模块,当我进入 pip3 冻结时,我也可以在列表中看到它。

虽然这个问题对于 numpy 来说已经解决了,但它不适用于其他 python 模块,例如configparser 3.8.1.

这就是我迄今为止所做的

sudo -H pip3 install --user matplotlib

Collecting matplotlib
Downloading https://files.pythonhosted.org/packages/89/61/465fb3bfba684b0f53b5c4829c3c89e86e6fe9fdcdfda93e38f1788090f0/matplotlib-3.0.3-cp35-cp35m-manylinux1_x86_64.whl (13.0MB)
|████████████████████████████████| 13.0MB 20.1MB/s 
Requirement already satisfied: numpy>=1.10.0 in /root/.local/lib/python3.5/site-packages (from matplotlib) (1.16.0)
Collecting pyparsing!=2.0.4,!=2.1.2,!=2.1.6,>=2.0.1 (from matplotlib)
Downloading https://files.pythonhosted.org/packages/11/fa/0160cd525c62d7abd076a070ff02b2b94de589f1a9789774f17d7c54058e/pyparsing-2.4.2-py2.py3-none-any.whl (65kB)
|████████████████████████████████| 71kB 35.8MB/s 
Collecting kiwisolver>=1.0.1 (from matplotlib)
Downloading https://files.pythonhosted.org/packages/ee/18/4cd2e84c6aff0c6a50479118083d20b9e676e5175a913c0ea76d700fc244/kiwisolver-1.1.0-cp35-cp35m-manylinux1_x86_64.whl (90kB)
|████████████████████████████████| 92kB 39.6MB/s 
Collecting python-dateutil>=2.1 (from matplotlib)
Downloading https://files.pythonhosted.org/packages/41/17/c62faccbfbd163c7f57f3844689e3a78bae1f403648a6afb1d0866d87fbb/python_dateutil-2.8.0-py2.py3-none-any.whl (226kB)
|████████████████████████████████| 235kB 56.2MB/s 
Collecting cycler>=0.10 (from matplotlib)
Downloading https://files.pythonhosted.org/packages/f7/d2/e07d3ebb2bd7af696440ce7e754c59dd546ffe1bbe732c8ab68b9c834e61/cycler-0.10.0-py2.py3-none-any.whl
Requirement already satisfied: setuptools in /usr/lib/python3/dist-packages (from kiwisolver>=1.0.1->matplotlib) (20.7.0)
Requirement already satisfied: six>=1.5 in /usr/lib/python3/dist-packages (from python-dateutil>=2.1->matplotlib) (1.10.0)
Installing collected packages: pyparsing, kiwisolver, python-dateutil, cycler, matplotlib
Successfully installed cycler-0.10.0 kiwisolver-1.1.0 matplotlib-3.0.3 pyparsing-2.4.2 python-dateutil-2.8.0




Then enter

pip3 freeze


blinker==1.3
chardet==2.3.0
cloud-init==19.1
command-not-found==0.3
configobj==5.0.6
cryptography==1.2.3
hibagent==1.0.1
idna==2.0
Jinja2==2.8
jsonpatch==1.10
jsonpointer==1.9
language-selector==0.1
MarkupSafe==0.23
numpy==1.17.1
oauthlib==1.0.3
prettytable==0.7.2
pyasn1==0.1.9
pycurl==7.43.0
pygobject==3.20.0
PyJWT==1.3.0
pyserial==3.0.1
python-apt==1.1.0b1+ubuntu0.16.4.5
python-debian==0.1.27
python-systemd==231
PyYAML==3.11
requests==2.9.1
six==1.10.0
ssh-import-id==5.5
ufw==0.35
unattended-upgrades==0.1
urllib3==1.13.1


Then enter

sudo -E pip3 install --upgrade matplotlib

Then enter 
pip3 freeze

blinker==1.3
chardet==2.3.0
cloud-init==19.1
command-not-found==0.3
configobj==5.0.6
cryptography==1.2.3
cycler==0.10.0
hibagent==1.0.1
idna==2.0
Jinja2==2.8
jsonpatch==1.10
jsonpointer==1.9
kiwisolver==1.1.0
language-selector==0.1
MarkupSafe==0.23
matplotlib==3.0.3
numpy==1.17.1
oauthlib==1.0.3
prettytable==0.7.2
pyasn1==0.1.9
pycurl==7.43.0
pygobject==3.20.0
PyJWT==1.3.0
pyparsing==2.4.2
pyserial==3.0.1
python-apt==1.1.0b1+ubuntu0.16.4.5
python-dateutil==2.8.0
python-debian==0.1.27
python-systemd==231
PyYAML==3.11
requests==2.9.1
six==1.10.0
ssh-import-id==5.5
ufw==0.35
unattended-upgrades==0.1
urllib3==1.13.1

我希望能够在 pip3安装后直接使用这些模块,但它们未列在 pip3 冻结列表中

我认为您已经安装了多个版本的numpy。首先尝试将它们全部删除

sudo apt-get remove numpy

pip3 uninstall numpy

然后重新安装

尝试使用Anaconda,它还包含许多对您的工作有用的软件包。

最新更新