gpt4 book ai didi

python - Errno 13 权限被拒绝。已经在虚拟环境中

转载 作者:行者123 更新时间:2023-12-04 18:28:59 26 4
gpt4 key购买 nike

我正在尝试在操作系统更新后安装 tensorflow。我收到 [Errno 13] 权限被拒绝。我检查过的所有论坛帖子都建议使用虚拟环境解决这个问题。问题是我已经在虚拟环境中工作了。

这是我使用的命令:

user@Computer:~$ cd /tensorflow
user@Computer:/tensorflow$ virtualenv --system-site-packages -p python3 venv
user@Computer:/tensorflow$ source /tensorflow/venv/bin/activate
(venv) user@Computer:/tensorflow$ pip install -U tensorflow-GPU

这是我得到的输出:
(venv) user@Computer:/tensorflow$ pip install -U tensorflow-GPU
Using cached https://files.pythonhosted.org/packages/64/ca/830b7cedb073ae264d215d51bd18d7cff7a2a47e39d79f6fa23edae17bb2/tensorflow_gpu-1.10.0-cp36-cp36m-manylinux1_x86_64.whl
Collecting gast>=0.2.0 (from tensorflow-GPU)
Collecting tensorboard<1.11.0,>=1.10.0 (from tensorflow-GPU)
Using cached https://files.pythonhosted.org/packages/c6/17/ecd918a004f297955c30b4fffbea100b1606c225dbf0443264012773c3ff/tensorboard-1.10.0-py3-none-any.whl
Collecting grpcio>=1.8.6 (from tensorflow-GPU)
Using cached https://files.pythonhosted.org/packages/31/17/0f79ff2f56018aa0e12ffb1cc8086df6bd6cfc71efea0df64fe78d569f71/grpcio-1.14.1-cp36-cp36m-manylinux1_x86_64.whl
Requirement already satisfied, skipping upgrade: six>=1.10.0 in /usr/lib/python3/dist-packages (from tensorflow-GPU) (1.11.0)
Collecting astor>=0.6.0 (from tensorflow-GPU)
Using cached https://files.pythonhosted.org/packages/35/6b/11530768cac581a12952a2aad00e1526b89d242d0b9f59534ef6e6a1752f/astor-0.7.1-py2.py3-none-any.whl
Collecting protobuf>=3.6.0 (from tensorflow-GPU)
Using cached https://files.pythonhosted.org/packages/fc/f0/db040681187496d10ac50ad167a8fd5f953d115b16a7085e19193a6abfd2/protobuf-3.6.0-cp36-cp36m-manylinux1_x86_64.whl
Requirement already satisfied, skipping upgrade: wheel>=0.26 in ./venv/lib/python3.6/site-packages (from tensorflow-GPU) (0.31.1)
Collecting absl-py>=0.1.6 (from tensorflow-GPU)
Collecting termcolor>=1.1.0 (from tensorflow-GPU)
Collecting setuptools<=39.1.0 (from tensorflow-GPU)
Using cached https://files.pythonhosted.org/packages/8c/10/79282747f9169f21c053c562a0baa21815a8c7879be97abd930dbcf862e8/setuptools-39.1.0-py2.py3-none-any.whl
Collecting numpy<=1.14.5,>=1.13.3 (from tensorflow-GPU)
Using cached https://files.pythonhosted.org/packages/68/1e/116ad560de97694e2d0c1843a7a0075cc9f49e922454d32f49a80eb6f1f2/numpy-1.14.5-cp36-cp36m-manylinux1_x86_64.whl
Collecting markdown>=2.6.8 (from tensorboard<1.11.0,>=1.10.0->tensorflow-GPU)
Using cached https://files.pythonhosted.org/packages/6d/7d/488b90f470b96531a3f5788cf12a93332f543dbab13c423a5e7ce96a0493/Markdown-2.6.11-py2.py3-none-any.whl
Collecting werkzeug>=0.11.10 (from tensorboard<1.11.0,>=1.10.0->tensorflow-GPU)
Using cached https://files.pythonhosted.org/packages/20/c4/12e3e56473e52375aa29c4764e70d1b8f3efa6682bef8d0aae04fe335243/Werkzeug-0.14.1-py2.py3-none-any.whl
Installing collected packages: gast, numpy, markdown, setuptools, protobuf, werkzeug, tensorboard, grpcio, astor, absl-py, termcolor, tensorflow-GPU
Could not install packages due to an EnvironmentError: [Errno 13] Permission denied: '/tensorflow/venv/lib/python3.6/site-packages/gast'
Consider using the `--user` option or check the permissions.

包含“--user”选项会产生以下结果
(venv) user@Computer:/tensorflow$ pip install --user tensorflow-GPU
Collecting tensorflow-GPU
Using cached https://files.pythonhosted.org/packages/64/ca/830b7cedb073ae264d215d51bd18d7cff7a2a47e39d79f6fa23edae17bb2/tensorflow_gpu-1.10.0-cp36-cp36m-manylinux1_x86_64.whl
Collecting absl-py>=0.1.6 (from tensorflow-GPU)
Collecting astor>=0.6.0 (from tensorflow-GPU)
Using cached https://files.pythonhosted.org/packages/35/6b/11530768cac581a12952a2aad00e1526b89d242d0b9f59534ef6e6a1752f/astor-0.7.1-py2.py3-none-any.whl
Collecting gast>=0.2.0 (from tensorflow-GPU)
Collecting tensorboard<1.11.0,>=1.10.0 (from tensorflow-GPU)
Using cached https://files.pythonhosted.org/packages/c6/17/ecd918a004f297955c30b4fffbea100b1606c225dbf0443264012773c3ff/tensorboard-1.10.0-py3-none-any.whl
Collecting termcolor>=1.1.0 (from tensorflow-GPU)
Collecting numpy<=1.14.5,>=1.13.3 (from tensorflow-GPU)
Using cached https://files.pythonhosted.org/packages/68/1e/116ad560de97694e2d0c1843a7a0075cc9f49e922454d32f49a80eb6f1f2/numpy-1.14.5-cp36-cp36m-manylinux1_x86_64.whl
Will not install to the user site because it will lack sys.path precedence to setuptools in /tensorflow/venv/lib/python3.6/site-packages

最佳答案

我做了更多的挖掘。

显然 virtualenv 是使用 sudo 创建的,所以我需要更改权限。

详情在这里:
How to avoid "Permission denied" when using pip with virtualenv

具体来说是

sudo chown -R your_username:your_username path/to/virtuaelenv/

关于python - Errno 13 权限被拒绝。已经在虚拟环境中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51756634/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com