最新補充說明:https://mirror.tuna.tsinghua.edu.cn/news/close-anaconda-service/html
首先說明致使該問題緣由是缺乏 openssl 支持,解決方法是添加 openssl 環境變量 或者不使用 HTTPS 。tips: python 大部分安裝源已啓用https鏈接方式。node
本文 Python 版本爲3.6.8。其餘使用方法版本相似。python
PS C:\Windows\system32> python Python 3.6.8 (tags/v3.6.8:3c6b436a57, Dec 24 2018, 00:16:47) [MSC v.1916 64 bit (AMD64)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> >>> exit() PS C:\Windows\system32>
Pycharm 社區版 版本爲2019.1。git
本文使用 Ananonda 版本爲2018.12,操做系統爲 Windows 10,其餘系統相似故障也能夠使用類本方法。github
首先介紹修改系統變量方法。添加openssl.exe到環境變量。web
#添加anaconda 安裝目錄openssl.exe文件夾 C:\ProgramData\Anaconda3\Library\bin
本文已經使用清華大學 Conda 安裝源,具體配置請看教程。 Pycharm 建立Conda 環境具體操做步驟爲 File - Settings- Project:[項目名稱] - Project Interpreter [齒輪圖標] -Add - Conda Interpreter ,點擊OK按鈕。編程
出現錯誤以下圖所示:json
錯誤信息以下:windows
#查看conda 信息 Windows PowerShell 版權全部 (C) Microsoft Corporation。保留全部權利。 PS C:\Windows\system32> conda info active environment : None user config file : C:\Users\legion\.condarc populated config files : conda version : 4.5.12 conda-build version : 3.17.6 python version : 3.7.1.final.0 base environment : D:\ProgramData\Anaconda3 (writable) channel URLs : https://repo.anaconda.com/pkgs/main/win-64 https://repo.anaconda.com/pkgs/main/noarch https://repo.anaconda.com/pkgs/free/win-64 https://repo.anaconda.com/pkgs/free/noarch https://repo.anaconda.com/pkgs/r/win-64 https://repo.anaconda.com/pkgs/r/noarch https://repo.anaconda.com/pkgs/pro/win-64 https://repo.anaconda.com/pkgs/pro/noarch https://repo.anaconda.com/pkgs/msys2/win-64 https://repo.anaconda.com/pkgs/msys2/noarch package cache : D:\ProgramData\Anaconda3\pkgs C:\Users\legion\AppData\Local\conda\conda\pkgs envs directories : D:\ProgramData\Anaconda3\envs C:\Users\legion\AppData\Local\conda\conda\envs C:\Users\legion\.conda\envs platform : win-64 user-agent : conda/4.5.12 requests/2.21.0 CPython/3.7.1 Windows/10 Windows/10.0.17763 administrator : True netrc file : None offline mode : False PS C:\Windows\system32> #安裝錯誤信息 PS C:\Windows\system32> conda install numpy Solving environment: failed CondaHTTPError: HTTP 000 CONNECTION FAILED for url <https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/menpo/win-64/repodata.json> Elapsed: - An HTTP error occurred when trying to retrieve this URL. HTTP errors are often intermittent, and a simple retry will get you on your way. SSLError(MaxRetryError('HTTPSConnectionPool(host=\'mirrors.tuna.tsinghua.edu.cn\', port=443): Max retries exceeded with url: /anaconda/cloud/menpo/win-64/repodata.json (Caused by SSLError("Can\'t connect to HTTPS URL because the SSL module is not available."))')) PS C:\Windows\system32> #anaconda官方網站升級軟件失敗 PS C:\Windows\system32> conda update conda Solving environment: failed CondaHTTPError: HTTP 000 CONNECTION FAILED for url <https://repo.anaconda.com/pkgs/msys2/noarch/repodata.json.bz2> Elapsed: - An HTTP error occurred when trying to retrieve this URL. HTTP errors are often intermittent, and a simple retry will get you on your way. If your current network has https://www.anaconda.com blocked, please file a support request with your network engineering team. SSLError(MaxRetryError('HTTPSConnectionPool(host=\'repo.anaconda.com\', port=443): Max retries exceeded with url: /pkgs/msys2/noarch/repodata.json.bz2 (Caused by SSLError("Can\'t connect to HTTPS URL because the SSL module is not available."))')) PS C:\Windows\system32> conda install numpy Solving environment: failed CondaHTTPError: HTTP 000 CONNECTION FAILED for url <https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/menpo/win-64/repodata.json> Elapsed: - An HTTP error occurred when trying to retrieve this URL. HTTP errors are often intermittent, and a simple retry will get you on your way. SSLError(MaxRetryError('HTTPSConnectionPool(host=\'mirrors.tuna.tsinghua.edu.cn\', port=443): Max retries exceeded with url: /anaconda/cloud/menpo/win-64/repodata.json (Caused by SSLError("Can\'t connect to HTTPS URL because the SSL module is not available."))')) PS C:\Windows\system32>
使用下文所示方法沒法解決問題。網站
#疑似無效解決方法 PS C:\Windows\system32> pip install -U spacy PS C:\Windows\system32> python -m spacy download en
Google一番後嘗試安裝OpenSSL Windows 64位版本,安裝到默認目錄,推薦到OpenSSL官方網站下載源代碼自行編譯安裝(須要必定編程基礎)。本文參考GitHub教程連接 ,安裝完畢openssl同時須要將安裝目錄添加到環境變量path。
教程連接:https://www.cloudinsidr.com/content/how-to-install-the-most-recent-version-of-openssl-on-windows-10-in-64-bit/ openssl windows 版本下載連接:https://slproweb.com/products/Win32OpenSSL.html PS C:\Program Files\OpenSSL-Win64\bin> cd / #切換到 openssl.exe 所在文件夾 PS C:\> cd '.\Program Files\OpenSSL-Win64\bin\' #檢查 openssl 版本 PS C:\Program Files\OpenSSL-Win64\bin> .\openssl version OpenSSL 1.1.1b 26 Feb 2019 #建立數字證書 PS C:\Program Files\OpenSSL-Win64\bin> .\openssl req -newkey rsa:2048 -nodes -keyout key.pem -x509 -days 365 -out certificate.pem Generating a RSA private key ...........................................................................................................................................+++++ ......................+++++ writing new private key to 'key.pem' ----- You are about to be asked to enter information that will be incorporated into your certificate request. What you are about to enter is what is called a Distinguished Name or a DN. There are quite a few fields but you can leave some blank For some fields there will be a default value, If you enter '.', the field will be left blank. ----- Country Name (2 letter code) [AU]:CN State or Province Name (full name) [Some-State]:Jiangsu Locality Name (eg, city) []:WUXI Organization Name (eg, company) [Internet Widgits Pty Ltd]:WUXI Organizational Unit Name (eg, section) []:IT Common Name (e.g. server FQDN or YOUR name) []:weiwei Email Address []:admin@examole.com #查看數字證書信息 PS C:\Program Files\OpenSSL-Win64\bin> .\openssl x509 -text -noout -in certificate.pem
所有操做完成後建立Conda環境正常。以下圖所示
安裝和升級軟件包正常。
PS C:\Windows\system32> conda install numpy Solving environment: done ==> WARNING: A newer version of conda exists. <== current version: 4.5.12 latest version: 4.6.8 Please update conda by running $ conda update -n base -c defaults conda ## Package Plan ## environment location: D:\ProgramData\Anaconda3 added / updated specs: - numpy The following packages will be downloaded: package | build ---------------------------|----------------- certifi-2018.11.29 | py37_0 146 KB https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main ca-certificates-2018.03.07 | 0 155 KB https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main numpy-1.15.4 | py37h19fb1c0_0 47 KB https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main openssl-1.1.1a | he774522_0 5.7 MB https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main conda-4.6.8 | py37_0 897 KB https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge ------------------------------------------------------------ Total: 7.0 MB The following packages will be UPDATED: ca-certificates: 2018.03.07-0 defaults --> 2018.03.07-0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main certifi: 2018.11.29-py37_0 defaults --> 2018.11.29-py37_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main conda: 4.5.12-py37_0 defaults --> 4.6.8-py37_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge numpy: 1.15.4-py37h19fb1c0_0 defaults --> 1.15.4-py37h19fb1c0_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main openssl: 1.1.1a-he774522_0 defaults --> 1.1.1a-he774522_0 https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main Proceed ([y]/n)? y Downloading and Extracting Packages certifi-2018.11.29 | 146 KB | ############################################################################ | 100% ca-certificates-2018 | 155 KB | ############################################################################ | 100% numpy-1.15.4 | 47 KB | ############################################################################ | 100% openssl-1.1.1a | 5.7 MB | ############################################################################ | 100% conda-4.6.8 | 897 KB | ############################################################################ | 100% Preparing transaction: done Verifying transaction: done Executing transaction: done PS C:\Windows\system32> PS C:\Windows\system32> conda update conda Collecting package metadata: done Solving environment: done # All requested packages already installed. PS C:\Windows\system32>