简体   繁体   English

将python 3模块安装为系​​统可执行文件

[英]Install python 3 modules as system executables

I want to install the autopep8 module for python 3 and be able to use it as a command line tool. 我想为python 3安装autopep8模块,并能够将其用作命令行工具。 But installing it this way, as suggested by this answer , using pip3 instead: 但是按照此答案的建议,以这种方式安装它,而是使用pip3

pip3 install autopep8

... does not do the trick: when I try to call autopep8 from the command line, I get a "command not found" error and a suggestion to install the python-autopep8 package. ...不能解决问题:当我尝试从命令行调用autopep8 ,出现“找不到命令”错误和建议安装python-autopep8软件包。

kenny@localhost:~$ pip3 install autopep8
Collecting autopep8
Collecting pep8>=1.5.7 (from autopep8)
  Using cached pep8-1.7.0-py2.py3-none-any.whl
Installing collected packages: pep8, autopep8
Successfully installed autopep8-1.2.2 pep8-1.7.0
kenny@localhost:~$ autopep8
The program 'autopep8' is currently not installed. You can install it by typing:
sudo apt install python-autopep8

But this package is for python 2.7! 但是此软件包适用于python 2.7! And I could not find a python3-autopep8 one. 而且我找不到python3-autopep8

Is there a way to install python 3 modules (using pip3 , for example) as executables, in the same manner that you would do, say, npm install -g ? 有没有一种方法可以像执行npm install -g一样将python 3模块(例如,使用pip3 )安装为可执行文件?

try this command for installation 尝试使用此命令进行安装

pip install --upgrade autopep8

and to use it try 并尝试使用它

autopep8 --in-place --aggressive --aggressive <filename>

to modify a file in place with aggressive level 2. Remember that autopep8 needs pep8 在积极级别2修改文件。请记住,autopep8需要pep8

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

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