我正在使用 Python 3.7 运行最新的 Kali Linux,并尝试使用 requests 模块。如您所见,我安装了请求,但仍然无法导入它。有人能帮我解决这个奇怪的问题吗?root@kali:~/Desktop# pip3 install --upgrade requestsRequirement already up-to-date: requests in /usr/local/lib/python3.7/site-packages (2.20.1)Requirement already satisfied, skipping upgrade: urllib3<1.25,>=1.21.1 in /usr/local/lib/python3.7/site-packages (from requests) (1.23)Requirement already satisfied, skipping upgrade: chardet<3.1.0,>=3.0.2 in /usr/local/lib/python3.7/site-packages (from requests) (3.0.4)Requirement already satisfied, skipping upgrade: certifi>=2017.4.17 in /usr/local/lib/python3.7/site-packages (from requests) (2018.10.15)Requirement already satisfied, skipping upgrade: idna<2.8,>=2.5 in /usr/local/lib/python3.7/site-packages (from requests) (2.7)root@kali:~/Desktop# python3Python 3.5.6 (default, Sep 29 2018, 21:41:04) [GCC 8.2.0] on linuxType "help", "copyright", "credits" or "license" for more information.>>> import requestsTraceback (most recent call last): File "<stdin>", line 1, in <module>ImportError: No module named 'requests'提前感谢您的帮助!
1 回答
料青山看我应如是
TA贡献1772条经验 获得超8个赞
由于您似乎Python
安装了多个版本,因此您需要设置要使用的环境Python 3.7
(当前设置为 3.5.6,并且似乎未安装 requests)。
在你.bash_profile
可能会这样做:
alias python3=/path/to/python3.7
输入时应使用 3.7 版本python3
...
添加回答
举报
0/150
提交
取消