使用numpy的问题

时间:2018-10-11 14:14:07

标签: python numpy pypy

我有 pypy (Python 2.7.13,[PyPy 6.0.0 with GCC 6.2.0 20160901]在linux2上)和 python (Python 2.7.14 [GCC 4.8.4]安装在同一台计算机上。

我可以无缝地将 numpy pypy 一起使用。但是,使用 python 时,出现以下错误。

Traceback (most recent call last):
File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python2.7/dist-packages/numpy/__init__.py", line 160, in <module>
    from . import random
  File "/usr/local/lib/python2.7/dist-packages/numpy/random/__init__.py", line 99, in <module>
    from .mtrand import *
ImportError: /usr/local/lib/python2.7/dist-packages/numpy/random/mtrand.so: undefined symbol: PyFPE_jbuf

我尝试了this stackoverflow答案中建议的解决方案。事情没有用。 当我尝试pip uninstall numpy时出现以下错误:Skipping numpy as it is not installed.

我还尝试再次为python安装numpy:sudo apt-get install python-numpy。我收到以下错误:

Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 python-numpy : Depends: python (>= 2.7) but it is not going to be installed
                Depends: python (< 2.8) but it is not going to be installed
                Depends: python:any (>= 2.7.1-0ubuntu2)
                Depends: python2.7:any

我尝试过的另一个选项是:sudo pip install numpy。我收到以下错误:

Command "/usr/bin/pypy -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-k3GbV2/numpy/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-record-8SqQxW/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-install-k3GbV2/numpy/
/usr/local/lib/pypy2.7/dist-packages/pip/_vendor/urllib3/util/ssl_.py:160: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings
  InsecurePlatformWarning

注意上述块中的内容 / usr / local / lib / pypy2.7 / dist-packages / pip / pip正在使用一些pypy2.7库。

我不太确定发生了什么。任何帮助将不胜感激。如果您需要任何进一步的信息,请告诉我。

2 个答案:

答案 0 :(得分:0)

只需回答这个问题的最后一部分,因为我之前曾收到过以下警告:

  

InsecurePlatformWarning一个真正的SSLContext对象不可用

要避免这种情况,您可以尝试:

...
<div *ngFor="let s of productIdFormArray; let i = index">
  <mat-form-field class="example-full-width">
...

答案 1 :(得分:0)

如果您将sudo pip installsudo apt install混合使用,则可能是系统混乱了。您可能想探索使用virtualenv来建立一个自包含的python,它完全位于一个文件夹中,可以使用usr级pip install进行管理,而无需使用sudo