I've come to a delicate situation:
My company's projects are all based in Python 2.7 and use specific PATH and PYTHONPATH exports to get around each other. The new machine I received has Ubuntu 22.04 and Python 3.10 preinstalled. My previous used to have Python 2.7 and I just installed 3.x on top and it worked just fine, at the beginning. I ended up messing up all the version altogether and everything seemed broken. So now I'm cautious on how to proceed
I've watched numerous tutorials online about setting up a virtual environment and how 'easy' it is to work with multiple version but seems that don't do the trick.
I would like to set up a virtual environment in Python 2.7 where I can just
python setup.py install ....
with all my packages and install them using python 2.7
At the same time, I'd like Python 3 to be available (because I'm futurizing some of these projects) to also install them using Python 3:
python3 setup.py install ...
What is the best strategy to implement this on my machine? Python 2 looks like it's not installed at all. Should I just install it on top of 3.10 ?
Related
While installling node.js I clicked on the automatically install update and dependencies option , it didn't detect python and automatically installed python 3.11 on my system and probably it has overwritten python 3.10 folder as a result all my libraries are removed python -V gives output as python 3.11 how do I fix this?(I have not yet removed python 3.10)
OS: Windows 10
tried checking django versions command not found even libraries like pandas not visible from cmd
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 learned that there are some issues in the latest Anaconda 3 python 3.7 version for object detection and face recognition deep learning problems from various posts. The official Anaconda site is only providing the latest python 3.7 version here. I want to work on a similar deep learning project in Windows 10(64 bit) which requires Anaconda 3 with python 3.6 version.
I found several posts providing solutions on StackOverflow for a Linux environment but I could not find any solution for the Windows 10 operating system. Can anyone share with me how to download the Anaconda 3 python 3.6 version?.
Any help will be highly appreciated.
Recommendation: Learn how to use conda by reading get started with conda. The problem you encounter is a very common case could be solved by conda, as an environment manager.
Solution 1
Use an environment with Python 3.6 installed, and activate this environment each time to work with your project.
# create an environment with python 3.6
conda create -n py36 python=3.6
# activate this environment
conda activate py36
This is also the preferred way to work with different projects. One environment for one project.
Solution 2
The default environment you're using with conda is base. You can override the Python 3.7 within base with Python 3.6
conda install -n base python=3.6
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 wish to develop and deploy python 3 codes, along with python 3 modules to OSX Yosemite and CentOS 7, both come with python 2 preinstalled.
I had installed python modules via pip and got the idea around developing with python 3 on Fedora 21, but I am not sure what's the best way to do this with OSX and CentOS.
I am aware that we can install python modules into a venv environment to keep it isolated from the system. Is it possible to have the whole python 3 environment isolated in venv and deploy that on CentOS/OSX? I have experimented this approach with Docker, but am feeling this is too much of a sledgehammer approach.
Is there a standard python way to develop python 3 code on primarily python 2 OS like OSX and CentOS without populating what's already on the system?
sunnz,
$ virtualenv venv_name --python=python3
Btw, if you install python3 directly in your system (OSX or CentOS) nothing bad will happen.