I am using Linux (solus Linux). I installed atom and need to know what package to install to use python 3.x.I have tried one of the package but it works with python 2.7
adding a code
!# /usr/bin/python3
at the top of my script helped me.
Also install scripts and configure it to use python3 instead
Related
I've been looking around and I can't seem to find an answer on how to run scrapyd in Python 3 and above. When I run it it keeps defaulting to python 2.7, though I recall reading in the docs or elsewhere that scrapyd supports python3:
https://scrapyd.readthedocs.io/en/stable/news.html#id1
Running on an AWS Ubuntu 18.04 server. What am I doing wrong? How can I change to Python 3.4 and above?
I'm having problems because I'm using abstract inheritance in my spiders which python 2.7 doesn't support.
Edit: I'm able to run Scrapyd in Python 3 using a virtual environment, but how would you do it without one?
Simplest solution is use a virtual enviroment.
Since you are using Ubuntu and you can make it work using a venv I assume you installed scrapy using pip instead of pip3. Since Py2.7 is the stardard reference to python in Ubuntu, when running pip it will execute pip for py2 instead of py3.
Another way would be uninstalling pip uninstall scrapy and installing it again using pip3 pip3 install scrapy. This should fix the reference to scrapy. If by any chance you also use scrapy in py2.7 and therefore can't uninstall, then you have another reason to use venv.
I have Ubuntu 19.04 OS and I needed python 3.6 version so I somehow managed to get python3.6 on my device without removing python3.7 but now I would like to revert back to using python3.7. Can anyone suggest how to do it?
If you've got multiple version of Python installed, you can choose which one to use as default in update-alternatives:
sudo update-alternatives --config python3
, then follow the prompt instructions.
Try using virtual environments, namely anaconda for these kinds of things. I am not aware of any other methods. Anaconda basically creates a virtual environment in which you can specify the version of all packages including python itself
I have a ROS package that has dependencies on various python and ROS libraries. Is it possible to provide a script in python that can install conda, ros2 and other python packages? If possible could anyone please help me giving a template .py file on how I can install conda and other python packages using conda?
You can use os.system:
import os
cmd="""ls -l"""
os.system(cmd)
I'm having trouble with Python 2.7 & 3.5. Right now I use GIT to acquire repositories and their python folders all have 2.7 syntax.
The problem: When i'm attempting to Automate using repositories, my .local/bin nosetests first line of code shows:
#!/usr/bin/python3
so, it checks for
.local/lib/Python3.5/site-packages/nose
Nowhere to be found is a Python 2.7 folder with similar directories to Python 3.5.
So I will always get a syntax error, as its checking my repositories Python coding, and since they are not Python3 syntax, it will give me errors. I checked using command
python -v
python3 -V
and indeed have 2.7 and 3.5 installed.
So I just need guidance/help on how to just gain Python 2.7 site packages with nosetests, so I can automate correctly using the same version as the repositories python. If I left out anything, I will try my best to fill in the gaps/add more details. I will of course troubleshoot.
Nowhere to be found is a Python 2.7 folder with similar directories to Python 3.5.
First, uninstall nosetests for python 3 with pip3 uninstall nose.
Then install nosetests for 2.7 with pip2.7 install nose.
After you do this, the default nosetests should be for python 2.7.
You may want to look into the default python for your project to python2.7 by using virtualenv.
I just installed Python3.4.2 yesterday on Windows 7. I tried typing out the command to download and install modules in the system terminal but I got Syntax Error. Within the terminal I typed: pip install pyPdf. Just wondering what my issue was.
Apparently, pyPdf is 2.x package
The raise syntax in Python 3.x no longer accepts comma-separated arguments
here is porting guide from 2.x to 3.x
http://docs.pythonsprints.com/python3_porting/py-porting.html