简体   繁体   English

无法使用 pip2.7 安装像 simpleHTTPServer 这样的软件包

[英]Can't install packages like simpleHTTPServer with pip2.7

I'm trying to install a module called simpleHTTPServer but can't do so as described below:我正在尝试安装一个名为 simpleHTTPServer 的模块,但无法如下所述安装:

root@kali:~# pip install simpleHTTPServer
DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python2.7 is no longer maintained. pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support pip 21.0 will remove support for this functionality.
ERROR: Could not find a version that satisfies the requirement simpleHTTPServer (from versions: none)
ERROR: No matching distribution found for simpleHTTPServer
root@kali:~#

I've screwed up my python2.7 a few hours ago by accidentally removing (rm) the python2.7 file in /usr/bin instead of renaming it with mv because i didn't pay attention to what i was doing.几个小时前,我不小心删除(rm)/usr/bin 中的 python2.7 文件而不是用 mv 重命名它,因为我没有注意我在做什么,我搞砸了我的 python2.7。 So I removed everything that had to do with python2.7.所以我删除了所有与python2.7有关的东西。 I've then managed to download python 2.7.18 from the official site and executed these commands below AS ROOT:然后我设法从官方网站下载了 python 2.7.18 并在 AS ROOT 下面执行了这些命令:

cd /home/johnmap007/Downloads/Python-2.7.18
./configure
make
make install
python setup.py clean
python setup.py build
python setup.py install

Then I got back up and running.然后我重新启动并运行。 pip started to work ok and python gives me the interpreter when i execute it in the cmd line. pip 开始正常工作,当我在 cmd 行中执行它时,python 为我提供了解释器。 I am running Kali Linux by the way.顺便说一下,我正在运行 Kali Linux。 I tried installing other packages like scapy and they worked.我尝试安装其他软件包,如 scapy,它们奏效了。 I don't know why i can't install this specific package.我不知道为什么我不能安装这个特定的包。 Any help would be greatly appreciated.任何帮助将不胜感激。 Thanks in advance!提前致谢!

EDIT: For some reason, as i was running apt upgrade, i got errors about python2.7 not being configured the right way:编辑:出于某种原因,当我运行 apt upgrade 时,我收到了关于 python2.7 没有以正确方式配置的错误:

Setting up python2.7 (2.7.18-1) ...
/var/lib/dpkg/info/python2.7.postinst: 9: /usr/bin/python2.7: not found
dpkg: error processing package python2.7 (--configure):
 installed python2.7 package post-installation script subprocess returned error exit status 127
Setting up sqlmap (1.4.11-1) ...
Installing new version of config file /etc/sqlmap/sqlmap.conf ...
Setting up libgstreamer-plugins-base1.0-0:amd64 (1.18.1-1) ...
Setting up libgstreamer-plugins-base1.0-0:i386 (1.18.1-1) ...
dpkg: dependency problems prevent configuration of python2:
 python2 depends on python2.7 (>= 2.7.18~); however:
  Package python2.7 is not configured yet.

dpkg: error processing package python2 (--configure):
 dependency problems - leaving unconfigured
Setting up seclists (2020.4-0kali1) ...
Setting up libgstreamer-gl1.0-0:amd64 (1.18.1-1) ...
Setting up gstreamer1.0-plugins-base:amd64 (1.18.1-1) ...
Setting up gstreamer1.0-plugins-base:i386 (1.18.1-1) ...
Setting up python3-cryptography (3.2.1-1) ...
Setting up libsvn1:amd64 (1.14.0-3) ...
dpkg: dependency problems prevent configuration of python2.7-dev:
 python2.7-dev depends on python2.7 (= 2.7.18-1); however:
  Package python2.7 is not configured yet.

dpkg: error processing package python2.7-dev (--configure):
 dependency problems - leaving unconfigured
Setting up gstreamer1.0-gl:amd64 (1.18.1-1) ...
Setting up gstreamer1.0-x:amd64 (1.18.1-1) ...
Setting up gstreamer1.0-x:i386 (1.18.1-1) ...
Setting up gstreamer1.0-alsa:amd64 (1.18.1-1) ...
dpkg: dependency problems prevent configuration of python2-dev:
 python2-dev depends on python2 (= 2.7.18-2); however:
  Package python2 is not configured yet.
 python2-dev depends on python2.7-dev (>= 2.7.18~); however:
  Package python2.7-dev is not configured yet.

dpkg: error processing package python2-dev (--configure):
 dependency problems - leaving unconfigured
Setting up gir1.2-gst-plugins-base-1.0:amd64 (1.18.1-1) ...
Setting up subversion (1.14.0-3) ...
Processing triggers for kali-menu (2020.4.0) ...
Processing triggers for libc-bin (2.31-4) ...
Processing triggers for man-db (2.9.3-2) ...
Errors were encountered while processing:
 python2.7
 python2
 python2.7-dev
 python2-dev
needrestart is being skipped since dpkg has failed
E: Sub-process /usr/bin/dpkg returned an error code (1)

I have no idea what happened and i tried running dpkg --configure -a already.我不知道发生了什么,我已经尝试运行 dpkg --configure -a 。 Can someone help me please?有人能帮助我吗?

That's in the standard library, so you don't need to install anything那是在标准库中,所以你不需要安装任何东西

https://docs.python.org/2/library/simplehttpserver.html https://docs.python.org/2/library/simplehttpserver.html

You can start it with你可以用

python -m SimpleHTTPServer

But you should use Python3, anyway, where it's renamed但无论如何,你应该使用 Python3,在它重命名的地方

python3 -m http.server 

I removed everything that had to do with python2.7我删除了与 python2.7 有关的所有内容

You're modifying operating system files at that point, and Kali Linux uses Python for more than your own scripting purposes.此时您正在修改操作系统文件,而 Kali Linux 使用 Python 不仅仅是为了您自己的脚本目的。 But based on /usr/bin/python2.7: not found , you could start symlink-ing files around to fix at least that error但是基于/usr/bin/python2.7: not found ,您可以开始符号链接文件以至少修复该错误

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

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