FelixTheNub FelixTheNub - 1 year ago 117
Linux Question

pip works for python2.7 but not 3.5

I'll start by saying I am a complete novice and am likely overlooking something obvious. Don't assume I have any idea about anything related to linux or python.

Anyway, I installed python 3.5 onto my computer which runs Fedora 23. Fedora comes prepackaged with 2.7. When I installed 3.5, I somehow installed it into my /home/user/Documents directory. I since deleted that

rm -r -f /home/user/Documents/Python-3.5.1
directory. Yet I can still open 3.5 when I type
. Originally I created an alias to point to the python command in the home/user/Documents/Python-3.5.1 directory, so being able to still open 3.5 after deleting that directory and removing the alias is confusing, and must mean I had two python 3.5 installs. That's some backstory that isn't really my problem, but maybe it's related.

The issue I'm having is that I cannot install a module that I want to import for use in a Python 3.5 program.

When I type
pip install pyperclip
(I'm working through AutomateTheBoringStuff) pyperclip is installed for 2.7. If I open the python2.7 command line and type
import pyperclip
everything is fine, but if I try the same thing in the python3.5 command line I get an error saying the module does not exist.

I assume this is because pip installs the pyperclip module to the subdirectories associated with 2.7. How can I install modules for 3.5 using pip?

Answer Source

you can use python3 -m pip install pyperclip