【问题标题】:Pythonanywhere install modules permission denied errorPythonanywhere 安装模块权限被拒绝错误
【发布时间】:2018-06-15 06:10:23
【问题描述】:

如何安装upstoxpip install upstox 没有在 bash 控制台上安装模块。

11:54 ~ $ pip install upstox
Collecting upstox
  Using cached upstox-1.5.5-py2.py3-none-any.whl
Requirement already satisfied (use --upgrade to upgrade): requests in /usr/local/lib/python2.7/dist-packages (from upstox)
Requirement already satisfied (use --upgrade to upgrade): future in /usr/local/lib/python2.7/dist-packages (from upstox)
Collecting websocket-client (from upstox)
  Using cached websocket_client-0.46.0-py2.py3-none-any.whl
Requirement already satisfied (use --upgrade to upgrade): argparse in /usr/lib/python2.7 (from future->upstox)
Requirement already satisfied (use --upgrade to upgrade): importlib in /usr/local/lib/python2.7/dist-packages (from future->upstox)
Requirement already satisfied (use --upgrade to upgrade): six in /usr/local/lib/python2.7/dist-packages (from websocket-client->upstox)
Installing collected packages: websocket-client, upstox
Exception:
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/pip/basecommand.py", line 215, in main
    status = self.run(options, args)
  File "/usr/local/lib/python2.7/dist-packages/pip/commands/install.py", line 317, in run
    prefix=options.prefix_path,
  File "/usr/local/lib/python2.7/dist-packages/pip/req/req_set.py", line 742, in install
    **kwargs
  File "/usr/local/lib/python2.7/dist-packages/pip/req/req_install.py", line 831, in install
    self.move_wheel_files(self.source_dir, root=root, prefix=prefix)
  File "/usr/local/lib/python2.7/dist-packages/pip/req/req_install.py", line 1032, in move_wheel_files
    isolated=self.isolated,
  File "/usr/local/lib/python2.7/dist-packages/pip/wheel.py", line 346, in move_wheel_files
    clobber(source, lib_dir, True)
  File "/usr/local/lib/python2.7/dist-packages/pip/wheel.py", line 317, in clobber
    ensure_dir(destdir)
  File "/usr/local/lib/python2.7/dist-packages/pip/utils/__init__.py", line 83, in ensure_dir
    os.makedirs(path)
  File "/usr/lib/python2.7/os.py", line 157, in makedirs
    mkdir(name, mode)
OSError: [Errno 13] Permission denied: '/usr/local/lib/python2.7/dist-packages/websocket_client-0.46.0.dist-info'
11:54 ~ $ 

【问题讨论】:

  • 欢迎来到 Stack Overflow!这是一个熟悉的组合,在 pip 安装期间权限被拒绝。您可能会为不同的软件包寻找类似问题的答案。例如,This one 建议使用 sudo 或虚拟环境。

标签: pip installation pythonanywhere


【解决方案1】:

This help page on the PythonAnywhere site 说明了使用 pip 在那里安装东西时需要做的一些额外事情。本质上,您要么需要使用--user 标志,要么使用virtualenv。

【讨论】:

  • pip install --user upstox 安装成功
  • from upstox_api.api import * from datetime import datetime from pprint import pprint import os, sys from tempfile import gettempdir import math from time import sleep import time import schedule import urlparse from selenium import webdriver Traceback(最新最后调用):文件“/home/veepsirtt/upstok/vp-demo-pythonantwhar​​e.py”,第 1 行,在 from upstox_api.api import * ModuleNotFoundError: No module named 'upstox_api'
  • 您需要确保使用与您安装时相同的 Python 版本运行——例如。如果您使用 Python 3.6 运行代码,则应该使用 pip3.6 进行安装。
【解决方案2】:

只需使用 --user 标志示例:

pip3 install --user django-js-reverse

【讨论】:

    猜你喜欢
    • 2018-01-13
    • 2018-10-09
    • 2018-11-14
    • 1970-01-01
    • 1970-01-01
    • 2011-07-05
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多