简体   繁体   中英

Python installing package MAC OS X

I am trying to install the package requests in my Mac OS X but I got in trouble. In the First time I installed it using "pip install requests" but I got some exceptions during the installation time and the package was not installed correct. In this way I am still not able to use it in my code but when I try to install it again I get a message saying it is already installed. Even that the folder do not exist. I already tried to uninstall python and requests package but I was not able to do it. PS: I am new at MACs...

http://postimg.org/image/sc0ooqfit/

Since Mac is pre-installed with Python2, you might have installed requests with Python2 if you didn't modify the path for Python3 as the first preference.

I would suggest you downloading requests directly here https://github.com/kennethreitz/requests/zipball/master

and install it with Python3 in the command line manually.

这个答案有点矫kill过正,但是在软件包管理麻烦之后,我能给您的最佳答案是:“ download Anaconda” http://continuum.io/downloads,因为它已经具有Python + 150个库(包括请求),并且可以获取大部分内容使用Conda工具可以简化所需的包装。

As I can see you are using Pycharm IDE and it is using python 3 as its default interpreter.

You can either install requests via pycharm itself: Go to Pycharm -> Preferences -> Default Project -> Project Interpreter -> Click on '+', search for 'requests' and click 'Install Package'

Or you can change interpreter to python 2.7 via the same 'Project Interpreter' section (just select it via dropdown). And you already have requests installed in your python 2.7 packages.

Had the same problem. The log said it failed to create a directory "error: could not create '/Library/Python/2.7/site-packages/requests': Permission denied".

Realized at that point the the problem was that I need to be root to do the install.

For me the answer was "sudo pip install requests"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM