I am new to python, and I have become interested in learning more about th efficiency of my functions. For example using generators vs. normal getter functions returning lists. I heard that you can measure the memory used by your python program by using the following code.
import psutil
print(psutil.virtual_memory())
I installed pip successfully, but i am unable to install psutil using the following command on terminal
pip install psutil
I get the following error
cc -bundle -undefined dynamic_lookup -arch x86_64 -arch i386 -Wl,-F. build/temp.macosx-10.12-intel-2.7/psutil/_psutil_posix.o -o build/lib.macosx-10.12-intel-2.7/psutil/_psutil_posix.so running install_lib creating /Library/Python/2.7/site-packages/psutil error: could not create '/Library/Python/2.7/site-packages/psutil': Permission denied
There was more text before this. It seems to me there is some sort of permission issue. How do I fix this? I am running Python 3 from Sublime Text Editor. In the error it mentions "creating /Library/Python/2.7/site-packages/psutil".
You're trying to install the library in the system python installation. That requires root, and is probably not recommended.
Alternatives:
brew install python
and then pip
will work.sudo pip install psutil
will run with root privileges and will have write access to those directories. Not recommended.If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With