2015-09-09 16 views
0

使用Pycharm,我試圖安裝Pygall,它需要lxml和cairosvg。 我創建了一個 'requirements.txt' 文件列出模塊:Python + Pycharm = pbm安裝lxml&cairosvg'不屬於當前用戶的目錄'

執行的命令:

pip install lxml 

錯誤:

0:425: execution error: The directory '/Users/romain/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. 

輸出:

0:425: execution error: The directory '/Users/romain/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. 
You are using pip version 7.1.0, however version 7.1.2 is available. 
You should consider upgrading via the 'pip install --upgrade pip' command. 
The directory '/Users/romain/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. 
/Library/Python/2.7/site-packages/pip-7.1.0-py2.7.egg/pip/_vendor/requests/packages/urllib3/util/ssl_.py:90: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning. 
    InsecurePlatformWarning 
Command "/System/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python -c "import setuptools, tokenize;__file__='/private/var/folders/ml/g1gqdlfs4k36b_rpfk44hfrm0000gn/T/pycharm-packaging11.tmp/lxml/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /var/folders/ml/g1gqdlfs4k36b_rpfk44hfrm0000gn/T/pip-DMEwQL-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/var/folders/ml/g1gqdlfs4k36b_rpfk44hfrm0000gn/T/pycharm-packaging11.tmp/lxml (1) 

Pycharm我求婚解決方案:

Try to run this command from the system terminal. Make sure that you use the correct version of 'pip' installed for your Python interpreter located at '/System/Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7'. 

我試圖從命令行安裝,但後來我得到一個「已經滿足」消息:

$ pip install lxml 
Requirement already satisfied (use --upgrade to upgrade): lxml in ./anaconda/lib/python2.7/site-packages 

所以我想我不得不在屋裏Pycharm改變的用戶...我怎麼能這樣做?在彈出窗口中,我試圖通過我的第一個名字(我用作sudo帳戶)更改我的全名(第一個+姓氏),但我得到了同樣的錯誤...

+0

你試過chmod -r嗎? – gerosalesc

回答

0

sudo pip install lxml應該能夠移除任何Linux上的權限問題

如果您在Windows計算機上,請右鍵單擊命令提示符並選擇'以管理員身份運行',然後執行pip install命令。

+0

由於路徑'/ Users/romain/Library/Caches/pip/http',他在OS X上,因此他應該使用Linux(實際上是通用* nix)解決方案 –

+0

問題是如何在Pycharm中執行該操作。 。在命令行上安裝sudo pip已經告訴我軟件包已安裝。我猜Pycharm在某處使用了一種virtualenv,或者使用特定於會話的用戶......它在哪裏定義,以及如何更改它? –

+0

@romainjouin默認情況下,PyCharm不會創建或使用任何虛擬Python環境。 –