第一個執行的Python程序

1、Python 執行

python ingest_tmdb_from_file.py

提示如下

Traceback (most recent call last):
  File "ingest_tmdb_from_file.py", line 1, in <module>
    import requests
ImportError: No module named requests

2、通過搜索得知缺少requests包

3、安裝

方式1:

pipenv install requests

提示 ,可能是網絡問題

Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ConnectTimeoutError(<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x10b943990>, 'Connection to pypi.org timed out. (connect timeout=15)')': /simple/requests/
  Could not find a version that satisfies the requirement requests (from versions: )
No matching distribution found for requests

方式2:pip install requests -i http://pypi.douban.com/simple/ --trusted-host pypi.douban.com

安裝成功

不過執行 以下命令任然有問題

python ingest_tmdb_from_file.py

方式3:經過反覆嘗試排查,由於本機安裝了brew,管理安裝包的方式,存在多個python的版本2和3

因此採用python2的命令方式執行

python2 ingest_tmdb_from_file.py

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章