Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
3.3k views
in Technique[技术] by (71.8m points)

Python No module named 'requests' MacOS

In Pycharm I wrote:

import requests

url = 'https://www.w3schools.com/python/demopage.php'
myobj = {'somekey': 'somevalue'}

x = requests.post(url, data = myobj)

#print the response text (the content of the requested file):

print(x.text)

But I am getting the following error:

/Users/me/PycharmProjects/RegMe/venv/bin/python /Users/me/PycharmProjects/RegMe/main.py
Traceback (most recent call last):
  File "/Users/me/PycharmProjects/RegMe/main.py", line 1, in <module>
    import requests
ModuleNotFoundError: No module named 'requests'

Process finished with exit code 1

I am working on macOS big Sur, and latest version of python (python 3.9). Plus I have already installed the needed package like this:

python3 -m pip install requests

and also tried this:

pip3 install requests

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

2.1m questions

2.1m answers

60 comments

57.0k users

...