我已閱讀了許多類似的帖子,但沒有解決我的問題。當試圖導入請求時,我收到一個迴應,說沒有名爲請求的模塊。Python urllib.request - 無模塊命名請求
我已經安裝了PIP 3 我已經安裝了請求
下面是最新的輸出新鮮安裝Ubuntu 15.04的:
[email protected]:~/Python$ sudo pip3 install requests --upgrade
Downloading/unpacking requests from https://pypi.python.org/packages/2.7/r/requests/requests-2.7.0-py2.py3-none-any.whl#md5=564fb256f865a79f977e57b79d31659a Downloading requests-2.7.0-py2.py3-none-any.whl (470kB): 470kB downloaded Installing collected packages: requests Found existing installation: requests 2.2.1 Not uninstalling requests at /usr/lib/python3/dist-packages, owned by OS Successfully installed requests Cleaning up...
[email protected]:~/Python$ python connect.py
Traceback (most recent call last): File "connect.py", line 7, in import urllib.request
ImportError: No module named request
[email protected]:~/Python$
我在Windows下爲我正在開發的項目創建了一個Python腳本。該腳本工作得很好,但我覺得有必要從Windows下載到Ubuntu上。現在一切都壞了。我會嘗試粘貼代碼 - 希望我能正確地做到這一點 –
而且你是對的 - 我運行Python並顯示2.7.6。當我輸入python3 connect.py時,腳本運行良好。 (主要是,但我會調整它)。謝謝 –