繁体   English   中英

如何在 Ubuntu 18.04 上成功安装 sciencepython package?

[英]How do I install scientificpython package successfully on Ubuntu 18.04?

我已经在我的 Ubuntu 18.04 系统上安装了 Python 3.7.6。 我正在尝试安装名为“scientificpython”的 package,但始终收到以下错误消息。

(base) jit@jit-VirtualBox:~$ pip install scientificpython
Collecting scientificpython
  Using cached ScientificPython-2.9.4.tar.gz (688 kB)
    ERROR: Command errored out with exit status 1:
     command: /home/jit/anaconda3/bin/python -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-o8a8hyd1/scientificpython/setup.py'"'"'; __file__='"'"'/tmp/pip-install-o8a8hyd1/scientificpython/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-install-o8a8hyd1/scientificpython/pip-egg-info
         cwd: /tmp/pip-install-o8a8hyd1/scientificpython/
    Complete output (6 lines):
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-install-o8a8hyd1/scientificpython/setup.py", line 72
        print "netCDF not found, the netCDF module will not be built!"
                                                                     ^
    SyntaxError: Missing parentheses in call to 'print'. Did you mean print("netCDF not found, the netCDF module will not be built!")?
    ----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

我该如何解决这个问题?

根据您的回溯和ScientificPython 主页

因此,ScientificPython 只能与 Python 2.7 和 NumPy 1.8 一起使用,但不能与这两个软件的更高版本一起使用。

对于初学者,您正在使用 Python 3.7.6,它不能将print识别为存在于 Python 2 中的语句。

您可以从源安装 Python 2 ,或者使用诸如pyenv 之类的工具来管理多个 Python 版本。

尝试通过指定版本来安装 ScientificPython

命令:

pip install ScientificPython==2.9.4

或尝试:

python -m pip install ScientificPython==2.9.4

如果问题仍然存在,请尝试下载 package 的 tar 文件,然后手动安装。 提供了可用的链接。

https://files.pythonhosted.org/packages/a2/8e/6306c88c0e937af38ed3a40e2a08caf30c53ad7f33e2928f14ae2cf53961/ScientificPython-2.9.4.tar.gz

或者

https://src.fedoraproject.org/lookaside/extras/ScientificPython/ScientificPython-2.8.1.tar.gz/

或者

https://osdn.net/frs/g_redir.php?m=kent&f=anuga%2Fanuga_support_software%2Fubuntu_8.10%2FScientificPython-2.9.0.tar.gz

但 ScientificPython 仅适用于 Python 版本 2。因此建议使用名为 Scipy 的替代 package。

命令:

pip install scipy

或者

python -m pip install --user numpy scipy matplotlib ipython jupyter pandas sympy nose

我希望它能解决错误。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM