anaconda新建python3创建代码失败_如何解决 Pycharm 无法使用 Anaconda 2018.12 创建Conda 环境问题…

  • Post author:
  • Post category:python


本文Python 版本为3.6.8。

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。

本文使用Ananonda 版本为2018.12,系统为Windows 10。

本文已经使用清华大学Conda 安装源,具体配置请看教程。 Pycharm 创建Conda 环境具体操作步骤为 File – Settings- Project:[项目名称] – Project Interpreter [齿轮图标] -Add – Conda Interpreter,点击OK按钮。

出现错误如下图所示:

错误信息如下:

#查看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

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

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

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教程链接 ,同时将安装目录添加到环境变量。

教程链接: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>