Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/342.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 从environment.yml文件创建环境TQM访问被拒绝_Python_Pip_Conda - Fatal编程技术网

Python 从environment.yml文件创建环境TQM访问被拒绝

Python 从environment.yml文件创建环境TQM访问被拒绝,python,pip,conda,Python,Pip,Conda,我试图通过在管理员命令提示符下运行conda env create-f environment.yml从environment.yml文件创建环境。environment.yml文件如下所示: name: pytorch0.4 channels: - pytorch - defaults dependencies: - python=3.6.5 - pytorch=0.4.1 - torchvision - numpy - nltk - ipython - d

我试图通过在管理员命令提示符下运行
conda env create-f environment.yml
从environment.yml文件创建环境。
environment.yml
文件如下所示:

name: pytorch0.4
channels:
  - pytorch
  - defaults
dependencies:
  - python=3.6.5
  - pytorch=0.4.1
  - torchvision
  - numpy
  - nltk
  - ipython
  - docopt
  - pip
  - pip:
    - tqdm
运行命令后,出现以下错误:

Collecting package metadata (repodata.json): done
Solving environment: \
Warning: 2 possible package resolutions (only showing differing packages):
  - defaults/noarch::parso-0.8.1-pyhd3eb1b0_0, defaults/win-64::jedi-0.17.0-py36_0
  - defaults/noarch::parso-0.7.0-py_0, defaults/win-64::jedi-0.17.2-py36haa95532done
Preparing transaction: done
Verifying transaction: done
Executing transaction: done
Installing pip dependencies: - Ran pip subprocess with arguments:
['C:\\Users\\PC\\anaconda3\\envs\\pytorch0.4\\python.exe', '-m', 'pip', 'install', '-U', '-r', 'C:\\Users\\Assignment\\A2\\a2\\condaenv.1tcu2wl4.requirements.txt']
Pip subprocess output:
Requirement already satisfied: tqdm in c:\users\pc\anaconda3\envs\pytorch0.4\lib\site-packages (from -r C:\Users\Assignment\A2\a2\condaenv.1tcu2wl4.requirements.txt (line 1)) (4.56.0)
Collecting tqdm
  Using cached tqdm-4.58.0-py2.py3-none-any.whl (73 kB)
Installing collected packages: tqdm
  Attempting uninstall: tqdm
    Found existing installation: tqdm 4.56.0
    Uninstalling tqdm-4.56.0:
      Successfully uninstalled tqdm-4.56.0

Pip subprocess error:
ERROR: Could not install packages due to an OSError: [WinError 5] Access is denied: 'C:\\Users\\PC\\AppData\\Local\\Temp\\pip-uninstall-yeq37y9s\\tqdm.exe'
Consider using the `--user` option or check the permissions.


failed

CondaEnvException: Pip failed

我认为我的环境创建不正确,因为我无法在环境中使用依赖项,也无法激活它。我还试图通过运行
pip install tqdm--user
来安装
tqdm
,它表示
要求已经满足:tqdm位于c:\users\pc\appdata\roaming\python\python38\site packages(4.58.0)
。那么我如何启动该环境呢?

康达应该能够解决这个问题,而无需求助于
pip
,因为
tdqm
默认频道上可用。此外,
nltk
tdqm
作为依赖项,因此YAML可以简化为

文件:pytorch0.4.yaml

name:pytorch0.4
频道:
-皮托克
-默认值
依赖项:
-python=3.6.5
-pytorch=0.4.1
-火炬视觉
-努比
-nltk
-伊皮顿
-docopt
-皮普

此外,在Conda环境中使用
pip
也是有效的。其中之一是永远不要使用
--user
标志,因为这最终会将包放置在环境的
站点包之外,并可能导致违反Conda非常热衷于建立的环境隔离。

Conda不能很好地处理系统级或用户级Python安装,尤其是在
--用户安装软件包时。如果您想要定义良好的行为,则需要确保Conda环境是隔离的(例如,摆脱用户级Python)。此外,我不了解使用
pip安装
tdqm
的原因。不仅是它,而且
nltk
明确地依赖于它,因此它肯定已经通过Conda安装了。整个`-pip:`部分可能会被删除。@merv,你能把它写下来作为答案吗?我会选择它。