系统信息:Ubuntu 18.04.4 LTS(GNU / Linux 4.15.0-88-通用x86_64)
Python告诉我安装的模块安装为:
trever@server:~/$ sudo pip3 install --target=/usr/local/lib/python3.8/site-packages Pillow
WARNING: The directory '/home/trever/.cache/pip' or its parent directory is not owned or is not writable by the current user. The cache has been disabled. Check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Collecting Pillow
Downloading Pillow-7.0.0-cp36-cp36m-manylinux1_x86_64.whl (2.1 MB)
|████████████████████████████████| 2.1 MB 6.8 MB/s
Installing collected packages: Pillow
Successfully installed Pillow-7.0.0
trever@server:~/$ python StartDatascraper.py
Traceback (most recent call last):
File "StartDatascraper.py", line 1, in <module>
import modules.only as onlyfans
File "/home/trever/Only/modules/only.py", line 2, in <module>
from modules.helpers import get_directory, json_request, reformat, format_directory, format_media_set, export_archive, format_image
File "/home/trever/Only/modules/helpers.py", line 6, in <module>
from PIL import Image
ModuleNotFoundError: No module named 'PIL'
trever@server:~/OnlyFans$ cd /usr/local/lib/python3.8
trever@server:/usr/local/lib/python3.8$ ls
dist-packages site-packages
trever@server:/usr/local/lib/python3.8$ cd site-packages/
trever@server:/usr/local/lib/python3.8/site-packages$
trever@server:/usr/local/lib/python3.8/site-packages$ ls
PIL Pillow-7.0.0.dist-info
我的python设置为python 3.8.2
trever@server:/usr/local/lib/python3.8/site-packages$ python --version
Python 3.8.2
编辑1:
trever@server:~$ python -c 'import sys;print(sys.path)'
['', '/usr/lib/python38.zip', '/usr/lib/python3.8', '/usr/lib/python3.8/lib-dynload', '/usr/local/lib/python3.8/dist-packages', '/usr/lib/python3/dist-packages']
编辑2: 我注意到这是python3.6而不是python3.8。
trever@server:~$ sudo pip3 install Pillow
[sudo] password for trever:
WARNING: The directory '/home/trever/.cache/pip' or its parent directory is not owned or is not writable by the current user. The cache has been disabled. Check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Requirement already satisfied: Pillow in /usr/local/lib/python3.6/dist-packages (7.0.0)
编辑3:
trever@server:~$ type python
python is hashed (/usr/bin/python)
编辑4:
trever@server:~$ sudo /usr/bin/python -m pip install Pillow
/usr/bin/python: No module named pip