简体   繁体   English

使用命令行安装外部Python模块-未提供命令

[英]Installing External Python Module using Command Line - No Command Supplied

I am trying to install a python module manually without pip or easy_install in Python 3. At first I tried (after cd to the folder containing the setup.py file): 我试图在Python 3中手动安装不带pipeasy_install的python模块。起初,我尝试过(在cd到包含setup.py文件的文件夹之后):

python setup.py install

However, I recieved an error: 但是,我收到一个错误:

'python' is not recognized as an internal or external command, operable program or batch file. 无法将“ python”识别为内部或外部命令,可操作程序或批处理文件。

After a little research , I realised that without the python it should work: 经过一些研究 ,我意识到没有python应该可以工作:

setup.py install

This also gave me an error: 这也给了我一个错误:

error: no command supplied 错误:未提供命令

More researching told me to go back to python setup.py install (which doesn't work), and following these instructions and following links hasn't worked either. 更多研究告诉我,请返回python setup.py install (该命令无效),并且遵循这些说明和以下链接也无效。

I would appreciate any help in installing this module (the module being BeautifulSoup4 ). 在安装此模块(模块为BeautifulSoup4 )方面的任何帮助,我将不胜感激。

This probably means your python.exe is not in your PATH . 这可能意味着您的python.exe不在PATH

Invoking setup.py directly works because of Windows' file associations. 由于Windows的文件关联,因此直接调用setup.py即可。

The Python manual actually has an entry on how to set up your PATH , but its instructions are for Windows < 7, so here goes: Python手册实际上包含有关如何设置PATH的条目 ,但其说明适用于Windows <7。

  1. Hit Windows+PAUSE to bring up the System Properties dialog. 点击Windows + PAUSE弹出系统属性对话框。
  2. Click Advanced System Settings. 单击高级系统设置。
  3. Click Environment Variables. 单击环境变量。
  4. Add ;C:\\Python3;C:\\Python3\\Scripts (or wherever your Python is) to the PATH environment variable (preferably in the System variables section). ;C:\\Python3;C:\\Python3\\Scripts (或Python所在的位置)添加到PATH环境变量中(最好在“系统变量”部分中)。 It's handy to have the Scripts directory in there too, to be able to easily run pip and other scripts. 同样也有Scripts目录,可以轻松运行pip和其他脚本。
  5. OK out through all the dialog boxes. 单击所有对话框。
  6. Open a new command prompt (PATH changes do not always propagate automatically into open command prompts). 打开一个新的命令提示符(PATH更改并不总是自动传播到打开的命令提示符中)。
  7. Try python . 试试python Should work. 应该管用。

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

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