sudo pip成功安装后出现ModuleNotFoundError

时间:2018-10-14 00:15:52

标签: python macos pip

我正在尝试下载python 3的库。仅运行pip install pycrypto或尚未安装的任何其他库给我带来了巨大的错误

我在另一个问题中发布了一个问题:Using pip to install pycrypto library on mac

使用sudo表示库已成功安装,但是在运行程序时我仍然得到ModuleNotFoundError。 (我正在使用MacOS High Sierra)

$ sudo pip install pycrypto
Password:
The directory '/Users/Library/Caches/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/Users/Library/Caches/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Collecting pycrypto
  Downloading https://files.pythonhosted.org/packages/60/db/645aa9af249f059cc3a368b118de33889219e0362141e75d4eaf6f80f163/pycrypto-2.6.1.tar.gz (446kB)
    100% |████████████████████████████████| 450kB 2.3MB/s 
Installing collected packages: pycrypto
  Running setup.py install for pycrypto ... done
Successfully installed pycrypto-2.6.1
You are using pip version 9.0.1, however version 18.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.

$ python ./assignment1.py 
Traceback (most recent call last):
  File "./assignment1.py", line 3, in <module>
    import pycrypto
ModuleNotFoundError: No module named 'pycrypto'

0 个答案:

没有答案