Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/338.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 错误13拒绝许可。已经在虚拟环境中_Python_Ubuntu_Tensorflow_Virtualenv - Fatal编程技术网

Python 错误13拒绝许可。已经在虚拟环境中

Python 错误13拒绝许可。已经在虚拟环境中,python,ubuntu,tensorflow,virtualenv,Python,Ubuntu,Tensorflow,Virtualenv,我正在尝试在操作系统更新后安装tensorflow。我的[Errno 13]许可被拒绝。我查过的所有论坛帖子都建议使用虚拟环境解决这个问题。问题是我已经在虚拟环境中工作了 以下是我使用的命令: user@Computer:~$ cd /tensorflow user@Computer:/tensorflow$ virtualenv --system-site-packages -p python3 venv user@Computer:/tensorflow$ source /tensorflo

我正在尝试在操作系统更新后安装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.
(venv)user@Computer:/tensorflow$pip安装-U tensorflow GPU
使用缓存https://files.pythonhosted.org/packages/64/ca/830b7cedb073ae264d215d51bd18d7cff7a2a47e39d79f6fa23edae17bb2/tensorflow_gpu-1.10.0-cp36-cp36m-manylinux1_x86_64.whl
收集气体>=0.2.0(来自tensorflow GPU)
收集张力板=1.10.0(来自tensorflow GPU)
使用缓存https://files.pythonhosted.org/packages/c6/17/ecd918a004f297955c30b4fffbea100b1606c225dbf0443264012773c3ff/tensorboard-1.10.0-py3-none-any.whl
收集grpcio>=1.8.6(来自tensorflow GPU)
使用缓存https://files.pythonhosted.org/packages/31/17/0f79ff2f56018aa0e12ffb1cc8086df6bd6cfc71efea0df64fe78d569f71/grpcio-1.14.1-cp36-cp36m-manylinux1_x86_64.whl
已满足要求,跳过升级:六个>=1.10.0的/usr/lib/python3/dist包(来自tensorflow GPU)(1.11.0)
采集astor>=0.6.0(来自tensorflow GPU)
使用缓存https://files.pythonhosted.org/packages/35/6b/11530768cac581a12952a2aad00e1526b89d242d0b9f59534ef6e6a1752f/astor-0.7.1-py2.py3-none-any.whl
采集协议BUF>=3.6.0(来自tensorflow GPU)
使用缓存https://files.pythonhosted.org/packages/fc/f0/db040681187496d10ac50ad167a8fd5f953d115b16a7085e19193a6abfd2/protobuf-3.6.0-cp36-cp36m-manylinux1_x86_64.whl
已满足要求,跳过升级:wheel>=0.26 in./venv/lib/python3.6/site-packages(来自tensorflow GPU)(0.31.1)
收集absl py>=0.1.6(来自tensorflow GPU)
采集术语颜色>=1.1.0(来自tensorflow GPU)
采集设置工具=2.6.8(来自tensorboard=1.10.0->tensorflow GPU)
使用缓存https://files.pythonhosted.org/packages/6d/7d/488b90f470b96531a3f5788cf12a93332f543dbab13c423a5e7ce96a0493/Markdown-2.6.11-py2.py3-none-any.whl
收集werkzeug>=0.11.10(来自tensorboard=1.10.0->tensorflow GPU)
使用缓存https://files.pythonhosted.org/packages/20/c4/12e3e56473e52375aa29c4764e70d1b8f3efa6682bef8d0aae04fe335243/Werkzeug-0.14.1-py2.py3-none-any.whl
安装收集的软件包:gast、numpy、markdown、setuptools、protobuf、werkzeug、tensorboard、grpcio、astor、absl py、termcolor、tensorflow GPU
由于环境错误,无法安装程序包:[Errno 13]权限被拒绝:'/tensorflow/venv/lib/python3.6/site packages/gast'
考虑使用“-Upple”选项或检查权限。
包括“--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
(venv)user@Computer:/tensorflow$pip安装--用户tensorflow GPU
采集tensorflow GPU
使用缓存https://files.pythonhosted.org/packages/64/ca/830b7cedb073ae264d215d51bd18d7cff7a2a47e39d79f6fa23edae17bb2/tensorflow_gpu-1.10.0-cp36-cp36m-manylinux1_x86_64.whl
收集absl py>=0.1.6(来自tensorflow GPU)
采集astor>=0.6.0(来自tensorflow GPU)
使用缓存https://files.pythonhosted.org/packages/35/6b/11530768cac581a12952a2aad00e1526b89d242d0b9f59534ef6e6a1752f/astor-0.7.1-py2.py3-none-any.whl
收集气体>=0.2.0(来自tensorflow GPU)
收集张力板=1.10.0(来自tensorflow GPU)
使用缓存https://files.pythonhosted.org/packages/c6/17/ecd918a004f297955c30b4fffbea100b1606c225dbf0443264012773c3ff/tensorboard-1.10.0-py3-none-any.whl
采集术语颜色>=1.1.0(来自tensorflow GPU)
收集numpy=1.13.3(来自tensorflow GPU)
使用缓存https://files.pythonhosted.org/packages/68/1e/116ad560de97694e2d0c1843a7a0075cc9f49e922454d32f49a80eb6f1f2/numpy-1.14.5-cp36-cp36m-manylinux1_x86_64.whl
不会安装到用户站点,因为它将缺少/tensorflow/venv/lib/python3.6/site-packages中setuptools的sys.path优先级

我又挖了一些

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

详情如下:

具体地说是

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