Я думаю, у меня есть некоторые проблемы с Python и / или pip на моем Mac.У меня Python 2.7 установлен глобально, а затем я обычно настраиваю virtualenvs и устанавливаю Python3.6.4, но в последние дни или около того у меня возникали проблемы с такими пакетами, как Fabric и SSH2, где я либо не смог установить их с различными ошибками, либо сТкань, которую он выбрасывает, когда я пытаюсь импортировать пакет.
Я сейчас пытаюсь удалить Fabric и установить Fabric3 и ошибки его выброса, такие как:
Could not install packages due to an EnvironmentError: [Errno 13] Permission denied: '/Users/david/Documents/projects/uptimeapp/env/lib/python3.6/site-packages/Fabric3-1.14.post1.dist-info'
Consider using the `--user` option or check the permissions.
(env) Davids-MacBook-Air:uptimeapp david$ pip install fabric3 --user
Can not perform a '--user' install. User site-packages are not visible in this virtualenv.
Если я сделаю sudo pip install fabric
, тогда этоустанавливает, но с этим предупреждением:
The directory '/Users/david/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/david/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.
Но я думал, что не рекомендуется устанавливать pip с помощью sudo?
Это ошибки, которые я получаю при попытке pip install ssh2-python
ssh2/agent.c:569:10: fatal error: 'libssh2.h' file not found
#include "libssh2.h"
^~~~~~~~~~~
1 error generated.
error: command 'clang' failed with exit status 1
----------------------------------------
Command "/Users/david/Documents/projects/uptimeapp/env/bin/python3.6 -u -c "import setuptools, tokenize;__file__='/private/var/folders/bl/97vt48j97zd2sj05zmt4xst00000gn/T /pip-install-mpyq41q4/ssh2-python/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /private/var/folders/bl/97vt48j97zd2sj05zmt4xst00000gn/T/pip-record-qul_k3kq/install-record.txt --single-version-externally-managed --compile - -install-headers /Users/david/Documents/projects/uptimeapp/env/bin/../include/site/python3.6 /ssh2-python" failed with error code 1 in /private/var/folders/bl/97vt48j97zd2sj05zmt4xst00000gn/T/pip-install-mpyq41q4/ssh2-python/
Мне удалось удалить Fabric и установить Fabric3 с помощью команды sudo, но я бы предпочел этого не делать.
Я должен добавить, что у меня не было других проблем с установкой других пакетов в глобальном масштабе вPython2.7 или в envs.