我在 Windows 10 版本 2004 x64 上使用 Python 3.9。以管理员身份使用 PowerShell。
蟒蛇版:
Python 3.9.0 (tags/v3.9.0:9cf6752, Oct 5 2020, 15:34:40) [MSC v.1927 64 bit (AMD64)] on win32
Run Code Online (Sandbox Code Playgroud)
安装matplotlib错误。
pip install virtualenv
virtualenv foo
cd .\foo
.\Scripts\active
pip install numpy
pip install matplotlib
Run Code Online (Sandbox Code Playgroud)
错误
Windows PowerShell
Copyright (C) Microsoft Corporation. All rights reserved.
Try the new cross-platform PowerShell https://aka.ms/pscore6
PS C:\WINDOWS\system32> Set-ExecutionPolicy Unrestricted -Force
PS C:\WINDOWS\system32> cd /d C:\Windows\System32\cmd.exe
Set-Location : A positional parameter cannot be found that accepts argument 'C:\Windows\System32\cmd.exe'. …Run Code Online (Sandbox Code Playgroud) 当我使用brew安装OpenCV时,每当我运行此命令进行测试时,我都会遇到此问题 brew
RuntimeError: module compiled against API version 9 but this version of numpy is 6
Traceback (most recent call last):
File "<string>", line 1, in <module>
ImportError: numpy.core.multiarray failed to import
Run Code Online (Sandbox Code Playgroud)
我试图升级numpy,但这很令人困惑
>>> import numpy
>>> print numpy.__version__
1.6.1
Run Code Online (Sandbox Code Playgroud)
当我运行brew来升级numpy时,我遇到了这个问题.
brew install -u numpy
Warning: numpy-1.9.1 already installed
Run Code Online (Sandbox Code Playgroud)
当我卸载它
sudo pip install numpy
Requirement already satisfied (use --upgrade to upgrade): numpy in ./anaconda/lib/python2.7/site-packages
Run Code Online (Sandbox Code Playgroud)
我已经关注了这个帖子并从我的mac中删除了anaconda.
pip install numpy
Requirement already satisfied (use --upgrade to upgrade): numpy in /Library/Python/2.7/site-packages …Run Code Online (Sandbox Code Playgroud) 尝试使用以下方法解决它:
pip install -U numpy
Run Code Online (Sandbox Code Playgroud)
但它仍然不起作用。
这是我尝试运行该应用程序时控制台向我显示的内容:
RuntimeError: module compiled against API version 0xa but this version of numpy is 0x9
Traceback (most recent call last):
File "/Users/Rubio/Desktop/logistic-regression/train.py", line 8, in <module>
import cv2
File "/Library/Python/2.7/site-packages/cv2/__init__.py", line 3, in <module>
from .cv2 import *
ImportError: numpy.core.multiarray failed to import
Run Code Online (Sandbox Code Playgroud)