简体   繁体   English

pip install tr​​ains 失败

[英]pip install trains fails

upon running pip install trains in my virtual env在我的虚拟环境中运行pip install trains

I am getting我正进入(状态

    ERROR: Command errored out with exit status 1:
     command: /home/epdadmin/noam/code/venv_linux/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-owzh8lnl/retrying/setup.py'"'"'; __file__='"'"'/tmp/pip-install-owzh8lnl/retrying/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-lxz5t8pu/install-record.txt --single-version-externally-managed --compile --install-headers /home/epdadmin/noam/code/venv_linux/include/site/python3.8/retrying
         cwd: /tmp/pip-install-owzh8lnl/retrying/
    Complete output (10 lines):
    running install
    running build
    running build_py
    creating build
    creating build/lib
    copying retrying.py -> build/lib
    running install_lib
    copying build/lib/retrying.py -> /home/epdadmin/noam/code/venv_linux/lib/python3.8/site-packages
    byte-compiling /home/epdadmin/noam/code/venv_linux/lib/python3.8/site-packages/retrying.py to retrying.cpython-38.pyc
    error: [Errno 13] Permission denied: '/home/epdadmin/noam/code/venv_linux/lib/python3.8/site-packages/__pycache__/retrying.cpython-38.pyc.139678407381360'
    ----------------------------------------
ERROR: Command errored out with exit status 1: /home/epdadmin/noam/code/venv_linux/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-owzh8lnl/retrying/setup.py'"'"'; __file__='"'"'/tmp/pip-install-owzh8lnl/retrying/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-lxz5t8pu/install-record.txt --single-version-externally-managed --compile --install-headers /home/epdadmin/noam/code/venv_linux/include/site/python3.8/retrying Check the logs for full command output.

I know that I am not supposed to run under sudo when using a venv , so I don't really understand the problem我知道在使用 venv 时我不应该在 sudo 下运行,所以我真的不明白这个问题

running for example pip install pandas does work.运行例如pip install pandas确实有效。

Python 3.8蟒蛇 3.8

How to install trains?如何安装火车?


EDIT:编辑:

running pip install trains --user or pip install --user trains gives运行pip install trains --userpip install --user trains给出

ERROR: Can not perform a '--user' install. User site-packages are not visible in this virtualenv.

You have two options:您有两个选择:

  1. Create a virtual environment and install your packages inside it (preferred)创建一个虚拟环境并在其中安装您的软件包(首选)

  2. Install your packages inside your user home directory by passing --user flag通过传递 --user 标志将您的软件包安装在您的用户主目录中

    pip install --user

The problem was a permissions problem for the venv.问题是 venv 的权限问题。 Another problem was trains required some packages that were not yet available with wheels on Python3.8, so I had to downgrade Python to 3.7另一个问题是火车需要一些在 Python3.8 上还没有带轮子的包,所以我不得不将 Python 降级到 3.7

That venv was created using Pycharm, and for some reason it was created with low permissions.该 venv 是使用 Pycharm 创建的,出于某种原因,它是以低权限创建的。

There was probably a way to elevate its permissions, but instead I just deleted it and created another one using command line by可能有一种方法可以提升其权限,但我只是删除了它并使用命令行创建了另一个

python -m virtualenv --python=/usr/bin/python3.7 venv

And now pip install trains worked.现在pip install trains工作了。

Very annoying.很烦人。

I had the same error with installing matplotlib in Ubuntu 18.我在 Ubuntu 18 中安装 matplotlib 时遇到了同样的错误。

Running these lines worked for me:运行这些行对我有用:

sudo apt-get install python3-dev
apt-get install build-essential

As found on setup script exited with error: command 'x86_64-linux-gnu-gcc' failed with exit status 1如在安装脚本中发现的退出错误:命令 'x86_64-linux-gnu-gcc' failed with exit status 1

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM