简体   繁体   English

PythonAnywhere为2.7安装新模块

[英]PythonAnywhere install new module for 2.7

I"m trying to install html2text using the command below: 我正在尝试使用以下命令安装html2text:

>>pip install --username html2text

and I keep getting 'syntax error' and an arrow pointing to the last "l" in "install"... 而且我不断收到“语法错误”和指向“安装”中最后一个“ l”的箭头...

This would happen when you run this command in the python console. 当您在python控制台中运行此命令时,就会发生这种情况。

DEMO 演示

$ python
>>> pip install
  File "<stdin>", line 1
    pip install
              ^
SyntaxError: invalid syntax
>>> pip install --username html2text
  File "<stdin>", line 1
    pip install --username html2text
              ^
SyntaxError: invalid syntax
>>> exit()
$ 

Exit from the python console, and run it outside the python shell at an OS command prompt 从python控制台退出,然后在OS命令提示符下的python shell外部运行它

Here are a list of valid options: http://pip.readthedocs.org/en/latest/reference/pip_install.html#options May be you mean --upgrade ? 以下是有效选项的列表: http : //pip.readthedocs.org/en/latest/reference/pip_install.html#options可能是--upgrade吗?

It needs to be run from Bash, not Python and the correct command you're looking for is: 它需要从Bash运行,而不是从Python运行,而您正在寻找的正确命令是:

pip install --user html2text

The --user is literal, and not a placeholder for your username. --user是文字,而不是用户名的占位符。

Pip does not have a flag called --username . Pip没有名为--username的标志。 I have just checked with the manual for the Python package installer ( usr$ man pip ). 我刚刚检查了Python软件包安装程序的手册( usr$ man pip )。

try: 尝试:

sudo pip install html2text

use --user at last of your install command, so that the package will be installed only for the current user, not for all. 请在安装命令的最后使用--user,以便仅为当前用户安装软件包,而不是为所有用户安装。

pip install html2text --user

or 要么

pip3 install html2text --user

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

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