在Windows的PyCharm中设置anaconda解释器

时间:2019-05-09 09:57:28

标签: python python-3.x pycharm anaconda conda

我已经设置了anaconda 3和tensorflow,它们在anaconda命令行中运行良好。我想使用PyCharm,但无法添加解释器Conda。

我遵循了以下指示:

https://www.jetbrains.com/help/pycharm/configuring-python-interpreter.html

我尝试了不同的事情。首先是conda可执行文件是anaconda.exe的位置:

C:\Logiciels\Anaconda3\Scripts\anaconda.exe create -p     C:\Logiciels\Anaconda3\envs\Ex_Files_TensorFlow -y python=3.7

我得到了错误:

anaconda: error: argument : invalid choice: 'create' (choose from 'auth', 'label', 'channel', 'config', 'copy', 'download', 'groups', 'login', 'logout', 'move', 'notebook', 'package', 'remove', 'search', 'show', 'upload', 'whoami')

我尝试将conda.exe作为可执行文件:

C:\Logiciels\Anaconda3\Scripts\conda.exe create -p C:\Logiciels\Anaconda3\envs\Ex_Files_TensorFlow -y python=3.5

但是获得输出:

Collecting package metadata: ...working... failed


CondaHTTPError: HTTP 000 CONNECTION FAILED for url <https://repo.anaconda.com/pkgs/r/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/r/noarch/repodata.json.bz2 (Caused by SSLError("Can\'t connect to HTTPS URL because the SSL module is not available."))'))

我也尝试过:

C:\Logiciels\Anaconda3\python.exe create -p C:\Users\hel\.conda\envs\Ex_Files_TensorFlow -y python=3.7

命令输出为:

C:\Logiciels\Anaconda3\python.exe: can't open file 'create': [Errno 2] No such file or directory

但是文件存在并且在那里。为什么PyCharm没有看到它?

我还尝试了3.5版本而不是3.7版本,并且尝试使用其他文件夹来设置环境。

2 个答案:

答案 0 :(得分:1)

我发现conda.exe埋在文件夹中

  

C:\ Users \ MYUSER \ AppData \ Local \ Continuum \ anaconda3 \ Scripts

答案 1 :(得分:0)

如评论中所建议,我在conda提示符中使用以下命令查找了现有环境:

conda info --envs
返回环境的

出现在机器上 并将路径复制到“添加解释器”>“ Conda”>“现有环境”>“解释器”中的解释器字段