我在我的Mac上安装了OpenCV 3.1,也安装了cv2 pip install cv2.
vinllen@ $ pip install cv2
You are using pip version 7.1.0, however version 7.1.2 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
Requirement already satisfied (use --upgrade to upgrade): cv2 in /usr/local/lib/python2.7/site-packages
Run Code Online (Sandbox Code Playgroud)
但看起来cv2并cv不能使用:
Python 2.7.10 (default, Jul 13 2015, 12:05:58)
[GCC 4.2.1 Compatible Apple LLVM 6.1.0 (clang-602.0.53)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import cv2
Traceback (most recent call …Run Code Online (Sandbox Code Playgroud) 当我执行此命令时:
pip3 install opencv-python
我收到以下错误:
Installing build dependencies ... error ERROR: Command errored out with exit status 1:
command: /usr/bin/python3 /usr/lib/python3/dist-packages/pip install --ignore-installed --no-user --prefix /tmp/pip-build-env-z4c_sn6u/overlay --no-warn-script-location --no-binary :none: --only-binary :none: -i https://pypi.org/simple -- setuptools wheel scikit-build cmake pip 'numpy==1.11.3; python_version=='"'"'3.5'"'"'' 'numpy==1.13.3; python_version=='"'"'3.6'"'"'' 'numpy==1.14.5; python_version=='"'"'3.7'"'"'' 'numpy==1.17.3; python_version>='"'"'3.8'"'"'' cwd: None
Complete output (22 lines):
Ignoring numpy: markers 'python_version == "3.5"' don't match your environment
Ignoring numpy: markers 'python_version == "3.6"' don't match your environment
Ignoring numpy: markers 'python_version == "3.7"' don't …Run Code Online (Sandbox Code Playgroud) 我似乎无法导入 panda 包。我使用 Visual Studio code 来编码。我使用 Mac 并拥有 osX 10.14 Majove。
\n我试图编译的代码是:
\nimport numpy as np\nimport matplotlib.pyplot as plt\nimport pandas as pd\nhouse_data = pd.read_csv('house.csv')\nplt.plot(house_data['surface'], house_data['loyer'], 'ro', markersize=4)\nplt.show()\nRun Code Online (Sandbox Code Playgroud)\n当我尝试使用pip install pandas我的终端时:
(base) pip install pandas\nRequirement already satisfied: pandas in /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages (0.24.0)\nRequirement already satisfied: pytz>=2011k in /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages (from pandas) (2018.9)\nRequirement already satisfied: python-dateutil>=2.5.0 in /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages (from pandas) (2.7.5)\nRequirement already satisfied: numpy>=1.12.0 in /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages (from pandas) (1.15.3)\nRequirement already satisfied: six>=1.5 in /Users/Library/Python/3.7/lib/python/site-packages (from python-dateutil>=2.5.0->pandas) (1.12.0)\n(base) Thibaults-MBP-5d47:ML_folder …Run Code Online (Sandbox Code Playgroud) 我希望可以问这个问题,即使这不是一个具体的编程问题。我在 Sublime Text 3 中安装了SublimeLinter和软件包。我安装并重新启动,但控制台显示以下消息:SublimeLinter-flake8pip install flake8
SublimeLinter:警告:无法找到“flake8”。填写“python”或“可执行文件”设置。警告:SublimeLinter.lint.base_linter.python_linter:无法找到“flake8”。填写“python”或“可执行文件”设置
我怀疑这可能与在用户设置中设置路径有关,但我不确定如何处理。正如你所看到的,我是一个相对新手。谢谢。
最终,每次我安装一个新的 Linux 发行版时,我都会这样做sudo apt-get install python3。
但是,一旦安装,我总是感到困惑。python是 Python 2.7 和python3Python 3.x。但它似乎pip也适用于 Python 2 和pip3Python 3。也就是说,我在 Internet 上看到的大多数教程总是使用传统的,pip install即使它是关于 Python 3 的。
我该如何处理?3每次我使用 Python ( pip3, ipython3, python3...)时,我是否应该继续让这个烦人的东西?在我的大部分讲座中,我都读到创建符号链接python->python3是一种不好的做法。那是对的吗?
python ×4
opencv ×2
python-3.x ×2
flake8 ×1
import ×1
importerror ×1
pandas ×1
sublimetext3 ×1