参考:
https://uoa-eresearch.github.io/eresearch-cookbook/recipe/2014/11/20/conda/
我运行以下命令来安装conda并创建虚拟环境。我的问题代码阻止后继续阅读。
C:\Windows\System32>conda -V
conda 4.1.11
C:\Windows\System32>conda update conda
Fetching package metadata .........
Solving package specifications: ..........
Package plan for installation in environment C:\Program Files\Miniconda2:
The following packages will be downloaded:
package | build
---------------------------|-----------------
conda-env-2.6.0 | 0 498 B
enum34-1.1.6 | py27_0 53 KB
conda-4.2.9 | py27_0 421 KB
------------------------------------------------------------
Total: 475 KB
The following NEW packages will be INSTALLED:
enum34: 1.1.6-py27_0
The following packages will be UPDATED:
conda: 4.1.11-py27_0 --> 4.2.9-py27_0
conda-env: 2.5.2-py27_0 --> 2.6.0-0
Proceed ([y]/n)? y
Fetching packages ...
conda-env-2.6. 100% |###############################| Time: 0:00:00 99.60 kB/s
enum34-1.1.6-p 100% |###############################| Time: 0:00:00 719.03 kB/s
conda-4.2.9-py 100% |###############################| Time: 0:00:00 1.33 MB/s
Extracting packages ...
[ COMPLETE ]|##################################################| 100%
Unlinking packages ...
[ COMPLETE ]|##################################################| 100%
Linking packages ...
[ COMPLETE ]|##################################################| 100%
C:\Windows\System32>
C:\Windows\System32>Python -V
Python 2.7.12
C:\Windows\System32>conda create -n ENV1 python=2.7.12 anaconda
...
<-- chose 'n' for install
我在这里选择'n',因为这是因为当我要求安装了十亿个程序(give或take)时,我的Linux服务器崩溃了,因为我的磁盘空间不足。相反,我选择'n',然后想将其记录到一个文件中,这样我就可以看到整个列表,因为我无法在Windows命令提示符下向上滚动,所以我运行下面的代码。它坐了一会儿,然后我用CTRL + C爆发了。我的问题代码阻止后继续阅读。
C:\Windows\System32>conda create -n ENV1 python=2.7.12 anaconda > C:\output.txt
y
Traceback (most recent call last):
File "C:\Program Files\Miniconda2\Scripts\conda-script.py", line 5, in <module
>
sys.exit(conda.cli.main())
File "C:\Program Files\Miniconda2\lib\site-packages\conda\cli\main.py", line 1
50, in main
return conda_exception_handler(_main)
File "C:\Program Files\Miniconda2\lib\site-packages\conda\exceptions.py", line
473, in conda_exception_handler
return_value = func(*args, **kwargs)
File "C:\Program Files\Miniconda2\lib\site-packages\conda\cli\main.py", line 1
44, in _main
exit_code = args.func(args, p)
File "C:\Program Files\Miniconda2\lib\site-packages\conda\cli\main_create.py",
line 68, in execute
install(args, parser, 'create')
File "C:\Program Files\Miniconda2\lib\site-packages\conda\cli\install.py", lin
e 405, in install
execute_actions(actions, index, verbose=not context.quiet)
File "C:\Program Files\Miniconda2\lib\site-packages\conda\plan.py", line 643,
in execute_actions
inst.execute_instructions(plan, index, verbose)
File "C:\Program Files\Miniconda2\lib\site-packages\conda\instructions.py", li
ne 134, in execute_instructions
cmd(state, arg)
File "C:\Program Files\Miniconda2\lib\site-packages\conda\instructions.py", li
ne 47, in FETCH_CMD
fetch_pkg(state['index'][arg + '.tar.bz2'])
File "C:\Program Files\Miniconda2\lib\site-packages\conda\fetch.py", line 336,
in fetch_pkg
download(url, path, session=session, md5=info['md5'], urlstxt=True)
File "C:\Program Files\Miniconda2\lib\site-packages\conda\fetch.py", line 419,
in download
for chunk in resp.iter_content(2**14):
File "C:\Program Files\Miniconda2\lib\site-packages\requests\models.py", line
664, in generate
for chunk in self.raw.stream(chunk_size, decode_content=True):
File "C:\Program Files\Miniconda2\lib\site-packages\requests\packages\urllib3\
response.py", line 353, in stream
data = self.read(amt=amt, decode_content=decode_content)
File "C:\Program Files\Miniconda2\lib\site-packages\requests\packages\urllib3\
response.py", line 310, in read
data = self._fp.read(amt)
File "C:\Program Files\Miniconda2\lib\httplib.py", line 612, in read
s = self.fp.read(amt)
File "C:\Program Files\Miniconda2\lib\socket.py", line 384, in read
data = self._sock.recv(left)
File "C:\Program Files\Miniconda2\lib\ssl.py", line 756, in recv
return self.read(buflen)
File "C:\Program Files\Miniconda2\lib\ssl.py", line 643, in read
v = self._sslobj.read(len)
KeyboardInterrupt
C:\Windows\System32>conda create -n ENV1 python=2.7.12 anaconda > C:\output.txt
CondaValueError: Value error: prefix already exists: C:\Program Files\Miniconda2
\envs\ENV1
如何删除ENV1前缀以便我可以尝试重新安装?如何在Windows中记录所有这些输出。如果我移动到C:\ output.txt。
,则输入不可见答案 0 :(得分:14)
我只是删除了文件夹C:\Program Files\Miniconda2\envs\ENV1\
。
答案 1 :(得分:0)
下次打开终端时,提示符为 (基础)C:\ Users \ whatever&gt; 只需输入: (基础)C:\ Users \ whatever&gt; conda激活ENV1
您的提示应更改为: (ENV1)C:\ Users \ whatever&gt;
一旦你的工作完成,就说: (ENV1)C:\ Users \ whatever&gt; conda deactivate
因为一遍又一遍地删除文件夹显然不方便
答案 2 :(得分:0)
您可以通过添加--force
选项来覆盖现有环境。
所以:
conda create -n ENV1 python=2.7.12 anaconda --force
请确保您已更新anaconda,因为它是最新功能。
答案 3 :(得分:0)
如果先前删除了conda环境,但是实际目录仍然存在(出于某种原因),那么“ conda env remove -n ENV1”将什么都不做:
$ conda-env list
# conda environments:
#
base * /home/nmanos/miniconda
test-env /home/nmanos/miniconda/envs/test-env
$ conda-env remove -n ENV1
# Nothing was removed (exit code zero)
$ ls /home/nmanos/miniconda/envs/ENV1
bin conda-meta etc go
# Directory still exists
因此,您可以删除实际的ENV1目录,如下所示:
$ ENV_BASE=$(conda-env list | awk '/base/ { print $NF }')
$ echo $ENV_BASE
/home/nmanos/miniconda
$ rm -rf "$ENV_BASE/envs/ENV1"