【问题标题】:Installing pip to import modules安装 pip 以导入模块
【发布时间】:2018-06-13 08:47:20
【问题描述】:

我正在尝试将 matplotlib 和 scipy 安装到 python,并使用 pip 来安装。但是,当我尝试使用 pip install scipy --myuser 安装 scipy 时,我收到了以下消息:

无效的要求'--myuser'

以前我使用 pip 安装了 numpy

python get-pip.py —myuser

pip install numpy —myuser

这很好,所以我不确定问题出在哪里。

这令人沮丧,因为我想从终端而不是 Windows 桌面使用 python。

【问题讨论】:

  • 你试过sudo python3 -m pip install scipy吗?
  • 我想当我早些时候关闭终端时,我可能已经卸载了 pip,因为使用 sudo 我收到消息“没有名为 pip 的模块”。尝试使用 wget https... 效果很好,但是在调用 python get-pip.py -user 时,我收到了相同的“无效要求 -user”消息。

标签: python ubuntu matplotlib pip


【解决方案1】:

您应该能够在不使用 --myuser 参数的情况下安装它。

sudo python3 -m pip install scipy
sudo python3 -m pip install matplotlib

或多合一

sudo python3 -m pip install scipy matplotlib

【讨论】:

    【解决方案2】:

    试试这个:

    sudo python3 -m pip install scipy matplotlib

    【讨论】:

    • 内联多模块安装
    • 当我尝试这种方法时,它告诉我“没有名为 pip 的模块”。但是,Pip 肯定已安装和更新。
    • 你试过sudo python -m pip install scipy metaplotlib吗?
    【解决方案3】:

    如果您想安装给用户,请尝试下面提到的命令:

    pip install --user scipy
    

    这里是 pip 命令的帮助:

    pip install --help
    
      --user                      Install to the Python user install directory for
                                  your platform. Typically ~/.local/, or
                                  %APPDATA%\Python on Windows. (See the Python
                                  documentation for site.USER_BASE for full
                                  details.)
    

    【讨论】:

    • 我收到一个错误“命令“python setup.py egg_info”在/tmp/pip-build-uh5QQI/matplotlib/中出现错误代码1失败”。我已经安装了 setuptools 和 dev 但无济于事
    • 我猜你安装了多个版本的 pip。你能用pip3试试吗?例如。 pip3 install --user scipy
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2021-11-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-09-21
    • 2021-05-19
    相关资源
    最近更新 更多