Jump to content

CentOS comes preinstalled with Python2.6.6 (I'm guessing to use something it needs).
I have a script that runs on Python 3.5+ while I install Python 5.3.1 I can't install it as a main thingy I guess so I have to use altmake, boom Python 3.5.1 installed! YAY!
Then go run my script... says I need module request, pip install requests, boom installed requests... still says I need requests, at this point, I guess requests is being installed on Python 2.6.6 (main install).

I can't for the life of me install requests module on Python3.5, anyone have any idea?
 

 

Thankssss.

Link to comment
https://linustechtips.com/topic/808077-python/
Share on other sites

Link to post
Share on other sites

just add #!/usr/bin/python3.5 at the start then just run the scripts ./script.py

                     ¸„»°'´¸„»°'´ Vorticalbox `'°«„¸`'°«„¸
`'°«„¸¸„»°'´¸„»°'´`'°«„¸Scientia Potentia est  ¸„»°'´`'°«„¸`'°«„¸¸„»°'´

Link to comment
https://linustechtips.com/topic/808077-python/#findComment-10148617
Share on other sites

Link to post
Share on other sites

11 minutes ago, Mitch619911 said:

To run my script I have to:

cd /opt
cd Python-3.5.1
python3.5 file.py

and it returns 

1371c0.png

sudo apt install pip3

pip3 install requests

 

I'm pretty sure just running it with python3 should work the same. 

                     ¸„»°'´¸„»°'´ Vorticalbox `'°«„¸`'°«„¸
`'°«„¸¸„»°'´¸„»°'´`'°«„¸Scientia Potentia est  ¸„»°'´`'°«„¸`'°«„¸¸„»°'´

Link to comment
https://linustechtips.com/topic/808077-python/#findComment-10148623
Share on other sites

Link to post
Share on other sites

10 minutes ago, vorticalbox said:

sudo apt install pip3

pip3 install requests

 

I'm pretty sure just running it with python3 should work the same. 

13738f.png

 

12 minutes ago, vorticalbox said:

#!/usr/bin/python3.5

Does nothing when added to the start?
-had to replace apt with yum.

Link to comment
https://linustechtips.com/topic/808077-python/#findComment-10148640
Share on other sites

Link to post
Share on other sites

15 minutes ago, Mitch619911 said:

Should I just install Debian or Ubuntu?

that's just giving in lol but sure if it doesn't matter what Linux you're using.

 

33 minutes ago, Mitch619911 said:

13738f.png

 

Does nothing when added to the start?
-had to replace apt with yum.

this just tells the termin where to find the interpreter you want to use, maybe its not /usr/bin like it is on ubuntu. 

                     ¸„»°'´¸„»°'´ Vorticalbox `'°«„¸`'°«„¸
`'°«„¸¸„»°'´¸„»°'´`'°«„¸Scientia Potentia est  ¸„»°'´`'°«„¸`'°«„¸¸„»°'´

Link to comment
https://linustechtips.com/topic/808077-python/#findComment-10148727
Share on other sites

Link to post
Share on other sites

3 hours ago, Mitch619911 said:

13738f.png

 

Does nothing when added to the start?
-had to replace apt with yum.

Your first command might be looking for the wrong package.  On Debian-based distros, at least, the package name for pip is python3-pip--not sure if it's the same in the CentOS repos, but look for something like that.  Also make sure you don't have a bash alias that points "pip3" at the Python 2.6 pip--it seems like that might be happening since when you type "pip3 install requests" it says it's looking in the Python 2.6 directories.

 

Also, after installing, run "pip install -U pip" to upgrade pip to the newest version (per the error message)--just to make sure you're using the newest version.  You can double-check what version of Python your pip install is configured for with "pip -V" (my output is pip 9.0.1 from /home/localuser/.local/lib/python3.5/site-packages (python 3.5), which tells me it's Python 3.5).  You can also try running pip explicitly through Python with "python3 -m pip [pip commands/options]".  That'll use your PATH variable to find the Python 3 executable, which should know where its corresponding version of pip is stored if you've installed it.

Link to comment
https://linustechtips.com/topic/808077-python/#findComment-10149238
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×