I';我无法在pycharm中安装opencv?

I';我无法在pycharm中安装opencv?,opencv,pycharm,opencv-python,Opencv,Pycharm,Opencv Python,我使用pip安装opencvpython通过cmd下载了opencv。但当我在pycharm中运行简单的读写程序时,它无法加载import cv2命令,当我搜索时,我知道pycharm有其他方法来安装opencv。我做了setting->project->project interperter然后搜索 opencv-python但它在安装过程中给了我以下错误: Collecting opencv-python Could not fetch URL https://pypi.org/simp

我使用
pip安装opencvpython
通过cmd下载了opencv。但当我在pycharm中运行简单的读写程序时,它无法加载
import cv2
命令,当我搜索时,我知道pycharm有其他方法来安装opencv。我做了
setting->project->project interperter
然后搜索 opencv-python但它在安装过程中给了我以下错误:

Collecting opencv-python
  Could not fetch URL https://pypi.org/simple/opencv-python/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/opencv-python/ (Caused by SSLError("Can't connect to HTTPS URL because the SSL module is not available.")) - skipping
Could not fetch URL https://pypi.org/simple/pip/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/pip/ (Caused by SSLError("Can't connect to HTTPS URL because the SSL module is not available.")) - skipping

pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.
  Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/opencv-python/
  Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/opencv-python/
  Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/opencv-python/
  Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/opencv-python/
  Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/opencv-python/
  Could not find a version that satisfies the requirement opencv-python (from versions: )
No matching distribution found for opencv-python
pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.

我有最新版本的python和pip,但尽管我遇到了此错误,请任何人帮助我。

很可能是您在基本conda环境中安装了opencv,而不是作为解释器激活的环境,或者是您在创建的环境中安装了opencv并激活了基本环境:

请尝试以下步骤:

conda create-n envname python

conda激活envname

pip安装opencv python


转到pycharm,将envname环境添加到pycharm解释器中,激活它,然后运行代码。

很可能是您在基本conda环境中安装了opencv,而不是作为解释器激活的环境,或者是您在创建的环境中安装了opencv并激活了基本环境:

请尝试以下步骤:

conda create-n envname python

conda激活envname

pip安装opencv python

转到pycharm,将envname环境添加到pycharm解释器,激活它,然后运行代码。

您的初始错误是:

Could not fetch URL https://pypi.org/simple/pip/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/pip/ (Caused by SSLError("Can't connect to HTTPS URL because the SSL module is not available."))
如果您是Windows用户,请将以下路径设置为系统的PATH环境变量:

如果使用蟒蛇:

<system_path>\Anaconda3
<system_path>\Anaconda3\scripts
<system_path>\Anaconda3\Library\bin
\Anaconda3
\Anaconda3\脚本
\Anaconda3\Library\bin
如果您的系统上只安装了Python,那么(我假设您的系统中安装了Python 3.6):

\Python36
\Python36\脚本
\Python36\Library\bin
然后尝试通过PyCharm安装opencv

希望这能解决您的问题。

您最初的错误是:

Could not fetch URL https://pypi.org/simple/pip/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/pip/ (Caused by SSLError("Can't connect to HTTPS URL because the SSL module is not available."))
如果您是Windows用户,请将以下路径设置为系统的PATH环境变量:

如果使用蟒蛇:

<system_path>\Anaconda3
<system_path>\Anaconda3\scripts
<system_path>\Anaconda3\Library\bin
\Anaconda3
\Anaconda3\脚本
\Anaconda3\Library\bin
如果您的系统上只安装了Python,那么(我假设您的系统中安装了Python 3.6):

\Python36
\Python36\脚本
\Python36\Library\bin
然后尝试通过PyCharm安装opencv


希望这能解决您的问题。

如何将envname添加到pycharm Interpreters?转到文件->设置->项目解释器->然后从下拉列表中按show all->然后按“+”->然后选中“现有环境”->然后单击解释器列表旁边的“…”然后转到路径c/users/your_user/anaconda3/envs/envname/python.exe,然后按ok并运行项目如何将envname添加到pycharm interpreter?进入文件->设置->项目解释器->然后从下拉列表中按show all->然后按“+”->然后选中“现有环境”-->然后单击解释器列表旁边的“…”->然后进入路径c/users/your_user/anaconda3/envs/envname/python.exe,然后按ok并运行项目